aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorAlex,Shi <alex.shi@intel.com>2011-09-06 22:26:36 -0400
committerPekka Enberg <penberg@kernel.org>2011-09-13 13:41:25 -0400
commit12d79634f8d7af5229b7d21143d50e7cf7d94177 (patch)
tree06096e3fdcc4c7fe84b9111d2f6274514bfb72b0 /mm/slub.c
parentaca726a07a71ff7aedc0e90a91f80a2701adcca5 (diff)
slub: Code optimization in get_partial_node()
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>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 0e286acef62a..4982fb5c91de 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1600,7 +1600,6 @@ static void *get_partial_node(struct kmem_cache *s,
1600{ 1600{
1601 struct page *page, *page2; 1601 struct page *page, *page2;
1602 void *object = NULL; 1602 void *object = NULL;
1603 int count = 0;
1604 1603
1605 /* 1604 /*
1606 * Racy check. If we mistakenly see no partial slabs then we 1605 * Racy check. If we mistakenly see no partial slabs then we
@@ -1613,17 +1612,16 @@ static void *get_partial_node(struct kmem_cache *s,
1613 1612
1614 spin_lock(&n->list_lock); 1613 spin_lock(&n->list_lock);
1615 list_for_each_entry_safe(page, page2, &n->partial, lru) { 1614 list_for_each_entry_safe(page, page2, &n->partial, lru) {
1616 void *t = acquire_slab(s, n, page, count == 0); 1615 void *t = acquire_slab(s, n, page, object == NULL);
1617 int available; 1616 int available;
1618 1617
1619 if (!t) 1618 if (!t)
1620 break; 1619 break;
1621 1620
1622 if (!count) { 1621 if (!object) {
1623 c->page = page; 1622 c->page = page;
1624 c->node = page_to_nid(page); 1623 c->node = page_to_nid(page);
1625 stat(s, ALLOC_FROM_PARTIAL); 1624 stat(s, ALLOC_FROM_PARTIAL);
1626 count++;
1627 object = t; 1625 object = t;
1628 available = page->objects - page->inuse; 1626 available = page->objects - page->inuse;
1629 } else { 1627 } else {