Skip to content

Commit

Permalink
slub: Code optimization in get_partial_node()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex,Shi authored and Pekka Enberg committed Sep 13, 2011
1 parent aca726a commit 12d7963
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 12d7963

Please sign in to comment.