Commit 12d79634 authored by Alex,Shi's avatar Alex,Shi Committed by Pekka Enberg

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: default avatarChristoph Lameter <cl@linux.com>
Signed-off-by: default avatarAlex Shi <alex.shi@intel.com>
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent aca726a0
...@@ -1600,7 +1600,6 @@ static void *get_partial_node(struct kmem_cache *s, ...@@ -1600,7 +1600,6 @@ static void *get_partial_node(struct kmem_cache *s,
{ {
struct page *page, *page2; struct page *page, *page2;
void *object = NULL; void *object = NULL;
int count = 0;
/* /*
* Racy check. If we mistakenly see no partial slabs then we * 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,17 +1612,16 @@ static void *get_partial_node(struct kmem_cache *s,
spin_lock(&n->list_lock); spin_lock(&n->list_lock);
list_for_each_entry_safe(page, page2, &n->partial, lru) { 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; int available;
if (!t) if (!t)
break; break;
if (!count) { if (!object) {
c->page = page; c->page = page;
c->node = page_to_nid(page); c->node = page_to_nid(page);
stat(s, ALLOC_FROM_PARTIAL); stat(s, ALLOC_FROM_PARTIAL);
count++;
object = t; object = t;
available = page->objects - page->inuse; available = page->objects - page->inuse;
} else { } else {
......
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