Skip to content

Commit

Permalink
slab: move up code to get kmem_cache_node in free_block()
Browse files Browse the repository at this point in the history
node isn't changed, so we don't need to retreive this structure
everytime we move the object.  Maybe compiler do this optimization, but
making it explicitly is better.

Signed-off-by: Joonsoo Kim <[email protected]>
Acked-by: Christoph Lameter <[email protected]>
Cc: Pekka Enberg <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoonsooKim authored and torvalds committed Aug 7, 2014
1 parent 8a9c61d commit 25c063f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -3398,7 +3398,7 @@ static void free_block(struct kmem_cache *cachep, void **objpp, int nr_objects,
int node)
{
int i;
struct kmem_cache_node *n;
struct kmem_cache_node *n = get_node(cachep, node);

for (i = 0; i < nr_objects; i++) {
void *objp;
Expand All @@ -3408,7 +3408,6 @@ static void free_block(struct kmem_cache *cachep, void **objpp, int nr_objects,
objp = objpp[i];

page = virt_to_head_page(objp);
n = get_node(cachep, node);
list_del(&page->lru);
check_spinlock_acquired_node(cachep, node);
slab_put_obj(cachep, page, objp, node);
Expand Down

0 comments on commit 25c063f

Please sign in to comment.