Skip to content

Commit

Permalink
slub: Set __GFP_COMP in kmem_cache by default
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Haifeng Xu authored and Vlastimil Babka committed Apr 15, 2024
1 parent 5aa5c7b commit 5b15f3f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5b15f3f

Please sign in to comment.