From: "Jan Beulich" <JBeulich@novell.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] adjust gfp mask passed on nested vmalloc() invocation
Date: Mon, 05 Oct 2009 11:16:14 +0100 [thread overview]
Message-ID: <4AC9E38E0200007800017F57@vpn.id2.novell.com> (raw)
- fix a latent bug resulting from blindly or-ing in __GFP_ZERO, since
the combination of this and __GFP_HIGHMEM (possibly passed into the
function) is forbidden in interrupt context
- avoid wasting more precious resources (DMA or DMA32 pools), when
being called through vmalloc_32{,_user}()
- explicitly allow using high memory here even if the outer allocation
request doesn't allow it, unless is collides with __GFP_ZERO
Signed-off-by: Jan Beulich <jbeulich@novell.com>
---
mm/vmalloc.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- linux-2.6.32-rc3/mm/vmalloc.c 2009-10-05 11:59:56.000000000 +0200
+++ 2.6.32-rc3-vmalloc-nested-gfp/mm/vmalloc.c 2009-10-05 08:40:36.000000000 +0200
@@ -1410,6 +1410,7 @@ static void *__vmalloc_area_node(struct
{
struct page **pages;
unsigned int nr_pages, array_size, i;
+ gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
nr_pages = (area->size - PAGE_SIZE) >> PAGE_SHIFT;
array_size = (nr_pages * sizeof(struct page *));
@@ -1417,13 +1418,16 @@ static void *__vmalloc_area_node(struct
area->nr_pages = nr_pages;
/* Please note that the recursion is strictly bounded. */
if (array_size > PAGE_SIZE) {
- pages = __vmalloc_node(array_size, gfp_mask | __GFP_ZERO,
+#ifdef CONFIG_HIGHMEM
+ /* See the comment in prep_zero_page(). */
+ if (!in_interrupt())
+ nested_gfp |= __GFP_HIGHMEM;
+#endif
+ pages = __vmalloc_node(array_size, nested_gfp,
PAGE_KERNEL, node, caller);
area->flags |= VM_VPAGES;
} else {
- pages = kmalloc_node(array_size,
- (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO,
- node);
+ pages = kmalloc_node(array_size, nested_gfp, node);
}
area->pages = pages;
area->caller = caller;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2009-10-05 12:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-05 10:16 Jan Beulich [this message]
2009-10-06 21:58 ` [PATCH] adjust gfp mask passed on nested vmalloc() invocation Hugh Dickins
2009-10-07 7:43 ` Jan Beulich
2009-10-07 12:08 ` Hugh Dickins
2009-10-07 12:20 ` Jan Beulich
2009-10-07 8:59 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC9E38E0200007800017F57@vpn.id2.novell.com \
--to=jbeulich@novell.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).