Commit f61396ae authored by Christoph Lameter's avatar Christoph Lameter

Move count_partial before kmem_cache_shrink

Move the counting function for objects in partial slabs so that it is placed
before kmem_cache_shrink.
Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 151c602f
...@@ -2607,6 +2607,19 @@ void kfree(const void *x) ...@@ -2607,6 +2607,19 @@ void kfree(const void *x)
} }
EXPORT_SYMBOL(kfree); EXPORT_SYMBOL(kfree);
static unsigned long count_partial(struct kmem_cache_node *n)
{
unsigned long flags;
unsigned long x = 0;
struct page *page;
spin_lock_irqsave(&n->list_lock, flags);
list_for_each_entry(page, &n->partial, lru)
x += page->inuse;
spin_unlock_irqrestore(&n->list_lock, flags);
return x;
}
/* /*
* kmem_cache_shrink removes empty slabs from the partial lists and sorts * kmem_cache_shrink removes empty slabs from the partial lists and sorts
* the remaining slabs by the number of items in use. The slabs with the * the remaining slabs by the number of items in use. The slabs with the
...@@ -3078,19 +3091,6 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, ...@@ -3078,19 +3091,6 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
return slab_alloc(s, gfpflags, node, caller); return slab_alloc(s, gfpflags, node, caller);
} }
static unsigned long count_partial(struct kmem_cache_node *n)
{
unsigned long flags;
unsigned long x = 0;
struct page *page;
spin_lock_irqsave(&n->list_lock, flags);
list_for_each_entry(page, &n->partial, lru)
x += page->inuse;
spin_unlock_irqrestore(&n->list_lock, flags);
return x;
}
#if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG) #if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG)
static int validate_slab(struct kmem_cache *s, struct page *page, static int validate_slab(struct kmem_cache *s, struct page *page,
unsigned long *map) unsigned long *map)
......
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