]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
[PATCH] nommu: use compound page in slab allocator
authorLuke Yang <luke.adi@gmail.com>
Tue, 11 Apr 2006 05:52:56 +0000 (22:52 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 11 Apr 2006 13:18:32 +0000 (06:18 -0700)
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.

Signed-off-by: Luke Yang <luke.adi@gmail.com>
Acked-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/slab.c

index 752c5570f2f636d6a96d4be2151077d024f47bb9..e6ef9bd52335bac10026972cb177f5de97eee817 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1456,7 +1456,14 @@ static void *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nodeid)
        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);