* Re: [PATCH] mm/slab.c: Delete the if judgment and return the result directly Remove the if judgment and return the result directly to reduce assembly statements.
[not found] <20230111083102.111535-1-lvqian@nfschina.com>
@ 2023-01-11 9:07 ` Vlastimil Babka
0 siblings, 0 replies; only message in thread
From: Vlastimil Babka @ 2023-01-11 9:07 UTC (permalink / raw)
To: lvqian, cl, penberg, rientjes, kim, akpm, roman.gushchin, 42.hyeyoo
Cc: linux-mm, linux-kernel
On 1/11/23 09:31, lvqian@nfschina.com wrote:
> From: lvqian <lvqian@nfschina.com>
The subject line is long, e.g. the second sentence should be part of body,
not subject.
Note the usual wording is "if statement" not "judgement"
> Remove the if judgment and return the result directly to reduce assembly statements.
I'm pretty sure there will be no effect on generated code/assembly, so it
should be purely about the C code readability. That's somewhat subjective,
but I think it's acceptable in this case.
> diff --git a/mm/slab.c b/mm/slab.c
> index 7a269db050ee..713265fe2dea 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -1415,11 +1415,8 @@ static void kmem_rcu_free(struct rcu_head *head)
> #if DEBUG
> static bool is_debug_pagealloc_cache(struct kmem_cache *cachep)
> {
> - if (debug_pagealloc_enabled_static() && OFF_SLAB(cachep) &&
> - (cachep->size % PAGE_SIZE) == 0)
> - return true;
> -
> - return false;
> + return debug_pagealloc_enabled_static() && OFF_SLAB(cachep) &&
> + ((cachep->size % PAGE_SIZE) == 0);
> }
>
> #ifdef CONFIG_DEBUG_PAGEALLOC
^ permalink raw reply [flat|nested] only message in thread