lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8042dcd4-41e6-a18d-3899-8f6d2696068a@suse.cz>
Date:   Wed, 11 Jan 2023 10:07:03 +0100
From:   Vlastimil Babka <vbabka@...e.cz>
To:     lvqian@...china.com, cl@...ux.co, penberg@...nel.org,
        rientjes@...gle.com, kim@....com, akpm@...ux-foundation.org,
        roman.gushchin@...ux.dev, 42.hyeyoo@...il.com
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: 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.

On 1/11/23 09:31, lvqian@...china.com wrote:
> From: lvqian <lvqian@...china.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ