slub: Simplify any_slab_object checks
authorChristoph Lameter <clameter@sgi.com>
Mon, 14 Apr 2008 16:11:41 +0000 (19:11 +0300)
committerPekka Enberg <penberg@cs.helsinki.fi>
Sun, 27 Apr 2008 15:28:18 +0000 (18:28 +0300)
Since we now have total_objects counter per node use that to
check for the presence of any objects. The loop over all cpu slabs
is not that useful since any cpu slab would require an object allocation
first. So drop that.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
mm/slub.c

index 23a2683..06533f3 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3775,14 +3775,6 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
 static int any_slab_objects(struct kmem_cache *s)
 {
        int node;
-       int cpu;
-
-       for_each_possible_cpu(cpu) {
-               struct kmem_cache_cpu *c = get_cpu_slab(s, cpu);
-
-               if (c && c->page)
-                       return 1;
-       }
 
        for_each_online_node(node) {
                struct kmem_cache_node *n = get_node(s, node);
@@ -3790,7 +3782,7 @@ static int any_slab_objects(struct kmem_cache *s)
                if (!n)
                        continue;
 
-               if (n->nr_partial || atomic_long_read(&n->nr_slabs))
+               if (atomic_read(&n->total_objects))
                        return 1;
        }
        return 0;