Commit d71abcaf authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] nr_slab accounting fix

From: Manfred Spraul <manfred@colorfullife.com>

if alloc_slabmgmt fails, then kmem_freepages() calls sub_page_state(),
altough nr_slab was not yet increased.  The attached patch fixes that by
moving the inc_page_state into kmem_getpages().
parent 6788a95d
......@@ -133,6 +133,7 @@ extern void get_full_page_state(struct page_state *ret);
#define inc_page_state(member) mod_page_state(member, 1UL)
#define dec_page_state(member) mod_page_state(member, 0UL - 1)
#define add_page_state(member,delta) mod_page_state(member, (delta))
#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
......
......@@ -812,6 +812,7 @@ static inline void *kmem_getpages(kmem_cache_t *cachep, unsigned long flags)
if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
atomic_add(i, &slab_reclaim_pages);
add_page_state(nr_slab, i);
while (i--) {
SetPageSlab(page);
page++;
......@@ -1608,7 +1609,6 @@ static int cache_grow (kmem_cache_t * cachep, int flags)
do {
SET_PAGE_CACHE(page, cachep);
SET_PAGE_SLAB(page, slabp);
inc_page_state(nr_slab);
page++;
} while (--i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment