From: Haifeng Xu Date: Sat, 13 Apr 2024 15:56:03 +0000 (+0000) Subject: slub: Set __GFP_COMP in kmem_cache by default X-Git-Tag: v6.10-rc1~230^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b15f3fb89fc23b52c3cf33e76a1ada83108b438;p=thirdparty%2Fkernel%2Flinux.git slub: Set __GFP_COMP in kmem_cache by default 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 Reviewed-by: Matthew Wilcox (Oracle) Signed-off-by: Vlastimil Babka --- diff --git a/mm/slub.c b/mm/slub.c index a30bd2157c07a..62a0bb2c3147d 100644 --- 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;