mm/slub.c: freelist is ensured to be NULL when new_slab() fails
authorPeng Wang <[email protected]>
Tue, 5 Mar 2019 23:42:00 +0000 (15:42 -0800)
committerLinus Torvalds <[email protected]>
Wed, 6 Mar 2019 05:07:14 +0000 (21:07 -0800)
new_slab_objects() will return immediately if freelist is not NULL.

         if (freelist)
                 return freelist;

One more assignment operation could be avoided.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Peng Wang <[email protected]>
Reviewed-by: Pekka Enberg <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/slub.c

index dc777761b6b70d32ca8c0479b85a0ecde0b00b88..a561f909446d895a787978e9c30cd95c88194cd4 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2482,8 +2482,7 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
                stat(s, ALLOC_SLAB);
                c->page = page;
                *pc = c;
-       } else
-               freelist = NULL;
+       }
 
        return freelist;
 }