]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
slab: move up code to get kmem_cache_node in free_block()
authorJoonsoo Kim <iamjoonsoo.kim@lge.com>
Wed, 6 Aug 2014 23:04:22 +0000 (16:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Aug 2014 01:01:14 +0000 (18:01 -0700)
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 <iamjoonsoo.kim@lge.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slab.c

index 7d07942b9804ed71d248b2ae91fb9a1a3152dcd5..205632c94a6aae3a544c12d232fd002602f5c21c 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -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;
@@ -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);