]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
slub: Code optimization in get_partial_node()
authorAlex,Shi <alex.shi@intel.com>
Wed, 7 Sep 2011 02:26:36 +0000 (10:26 +0800)
committerPekka Enberg <penberg@kernel.org>
Tue, 13 Sep 2011 17:41:25 +0000 (20:41 +0300)
I find a way to reduce a variable in get_partial_node(). That is also helpful
for code understanding.

Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Alex Shi <alex.shi@intel.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm/slub.c

index 0e286acef62a28d7dca1e9224210170a03087303..4982fb5c91dea290dc262dd62bfce8b5e7d92c40 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1600,7 +1600,6 @@ static void *get_partial_node(struct kmem_cache *s,
 {
        struct page *page, *page2;
        void *object = NULL;
-       int count = 0;
 
        /*
         * Racy check. If we mistakenly see no partial slabs then we
@@ -1613,17 +1612,16 @@ static void *get_partial_node(struct kmem_cache *s,
 
        spin_lock(&n->list_lock);
        list_for_each_entry_safe(page, page2, &n->partial, lru) {
-               void *t = acquire_slab(s, n, page, count == 0);
+               void *t = acquire_slab(s, n, page, object == NULL);
                int available;
 
                if (!t)
                        break;
 
-               if (!count) {
+               if (!object) {
                        c->page = page;
                        c->node = page_to_nid(page);
                        stat(s, ALLOC_FROM_PARTIAL);
-                       count++;
                        object = t;
                        available =  page->objects - page->inuse;
                } else {