]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
slub: Set __GFP_COMP in kmem_cache by default
authorHaifeng Xu <haifeng.xu@shopee.com>
Sat, 13 Apr 2024 15:56:03 +0000 (15:56 +0000)
committerVlastimil Babka <vbabka@suse.cz>
Mon, 15 Apr 2024 14:50:28 +0000 (16:50 +0200)
Now the __GFP_COMP is set only if the higher-order is not 0. However,
__GFP_COMP flag can be set unconditionally because compound page can
not be created in the order-0 case. And this can also simplify the code
a bit (no need to check the order is 0 or not).

Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c

index a30bd2157c07a20df0d65d1a4dc128fd0dac1005..62a0bb2c3147d2071e5533de6c350b8f3d65c442 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5089,9 +5089,7 @@ static int calculate_sizes(struct kmem_cache *s)
        if ((int)order < 0)
                return 0;
 
-       s->allocflags = 0;
-       if (order)
-               s->allocflags |= __GFP_COMP;
+       s->allocflags = __GFP_COMP;
 
        if (s->flags & SLAB_CACHE_DMA)
                s->allocflags |= GFP_DMA;