lkml.org 
[lkml]   [2006]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
Subject[PATCH] Fix mm regression bug: nommu use compound page in slab allocator -- added one comment
Hi all,

The earlier patch to consolidate mmu and nommu page allocation
and refcounting by using compound pages for nommu allocations
had a bug: kmalloc slabs who's pages were initially allocated
by a non-__GFP_COMP allocator could be passed into mm/nommu.c
kmalloc allocations which really wanted __GFP_COMP underlying
pages. Fix that by having nommu pass __GFP_COMP to all higher order
slab allocations.

Thanks Nick!

Signed-off-by: Luke Yang <luke.adi@gmail.com>
Acked-by: Nick Piggin <npiggin@suse.de>

slab.c | 7 +++++++
1 files changed, 7 insertions(+)

diff --git a/mm/slab.c b/mm/slab.c
index 4cbf8bb..5a782ff 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1454,7 +1454,14 @@ static void *kmem_getpages(struct kmem_c
int i;

flags |= cachep->gfpflags;
+#ifndef CONFIG_MMU
+ /* nommu uses slab's for process anonymous memory allocations, so
+ * requires __GFP_COMP to properly refcount higher order allocations"
+ */
+ page = alloc_pages_node(nodeid, (flags | __GFP_COMP), cachep->gfporder);
+#else
page = alloc_pages_node(nodeid, flags, cachep->gfporder);
+#endif
if (!page)
return NULL;
addr = page_address(page);
--
Best regards,
Luke Yang, Kernel for Blackfin maintainer
luke.adi@gmail.com
diff --git a/mm/slab.c b/mm/slab.c
index 4cbf8bb..5a782ff 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1454,7 +1454,14 @@ static void *kmem_getpages(struct kmem_c
int i;

flags |= cachep->gfpflags;
+#ifndef CONFIG_MMU
+ /* nommu uses slab's for process anonymous memory allocations, so
+ * requires __GFP_COMP to properly refcount higher order allocations"
+ */
+ page = alloc_pages_node(nodeid, (flags | __GFP_COMP), cachep->gfporder);
+#else
page = alloc_pages_node(nodeid, flags, cachep->gfporder);
+#endif
if (!page)
return NULL;
addr = page_address(page);
\
 
 \ /
  Last update: 2006-03-31 10:37    [W:0.111 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site