linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slub: Set __GFP_COMP in kmem_cache by default
@ 2024-04-13 15:56 Haifeng Xu
  2024-04-15 14:52 ` Vlastimil Babka
  0 siblings, 1 reply; 2+ messages in thread
From: Haifeng Xu @ 2024-04-13 15:56 UTC (permalink / raw)
  To: cl, vbabka, willy
  Cc: penberg, rientjes, iamjoonsoo.kim, akpm, roman.gushchin,
	42.hyeyoo, linux-mm, linux-kernel, Haifeng Xu

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>
---
 mm/slub.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index e7bf1a1a31a8..49a3ebefab86 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4461,9 +4461,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;
-- 
2.25.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] slub: Set __GFP_COMP in kmem_cache by default
  2024-04-13 15:56 [PATCH] slub: Set __GFP_COMP in kmem_cache by default Haifeng Xu
@ 2024-04-15 14:52 ` Vlastimil Babka
  0 siblings, 0 replies; 2+ messages in thread
From: Vlastimil Babka @ 2024-04-15 14:52 UTC (permalink / raw)
  To: Haifeng Xu, cl, willy
  Cc: penberg, rientjes, iamjoonsoo.kim, akpm, roman.gushchin,
	42.hyeyoo, linux-mm, linux-kernel

On 4/13/24 5:56 PM, Haifeng Xu wrote:
> 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>

Thanks, added to slab/for-next

> ---
>  mm/slub.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index e7bf1a1a31a8..49a3ebefab86 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -4461,9 +4461,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;



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-15 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-13 15:56 [PATCH] slub: Set __GFP_COMP in kmem_cache by default Haifeng Xu
2024-04-15 14:52 ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox