aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/mm/slab.c b/mm/slab.c
index a94cf0fea8a2..7bd19639efd3 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1489,31 +1489,29 @@ __initcall(cpucache_init);
1489static void *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nodeid) 1489static void *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nodeid)
1490{ 1490{
1491 struct page *page; 1491 struct page *page;
1492 void *addr; 1492 int nr_pages;
1493 int i; 1493 int i;
1494 1494
1495 flags |= cachep->gfpflags;
1496#ifndef CONFIG_MMU 1495#ifndef CONFIG_MMU
1497 /* nommu uses slab's for process anonymous memory allocations, so 1496 /*
1498 * requires __GFP_COMP to properly refcount higher order allocations" 1497 * Nommu uses slab's for process anonymous memory allocations, and thus
1498 * requires __GFP_COMP to properly refcount higher order allocations
1499 */ 1499 */
1500 page = alloc_pages_node(nodeid, (flags | __GFP_COMP), cachep->gfporder); 1500 flags |= __GFP_COMP;
1501#else
1502 page = alloc_pages_node(nodeid, flags, cachep->gfporder);
1503#endif 1501#endif
1502 flags |= cachep->gfpflags;
1503
1504 page = alloc_pages_node(nodeid, flags, cachep->gfporder);
1504 if (!page) 1505 if (!page)
1505 return NULL; 1506 return NULL;
1506 addr = page_address(page);
1507 1507
1508 i = (1 << cachep->gfporder); 1508 nr_pages = (1 << cachep->gfporder);
1509 if (cachep->flags & SLAB_RECLAIM_ACCOUNT) 1509 if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
1510 atomic_add(i, &slab_reclaim_pages); 1510 atomic_add(nr_pages, &slab_reclaim_pages);
1511 add_page_state(nr_slab, i); 1511 add_page_state(nr_slab, nr_pages);
1512 while (i--) { 1512 for (i = 0; i < nr_pages; i++)
1513 __SetPageSlab(page); 1513 __SetPageSlab(page + i);
1514 page++; 1514 return page_address(page);
1515 }
1516 return addr;
1517} 1515}
1518 1516
1519/* 1517/*