linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: lvqian@nfschina.com, cl@linux.co, penberg@kernel.org,
	rientjes@google.com, kim@lge.com, akpm@linux-foundation.org,
	roman.gushchin@linux.dev, 42.hyeyoo@gmail.com
Cc: linux-mm@kvack.org, linux-kernel@vger.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.
Date: Wed, 11 Jan 2023 10:07:03 +0100	[thread overview]
Message-ID: <8042dcd4-41e6-a18d-3899-8f6d2696068a@suse.cz> (raw)
In-Reply-To: <20230111083102.111535-1-lvqian@nfschina.com>

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



           reply	other threads:[~2023-01-11  9:07 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20230111083102.111535-1-lvqian@nfschina.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8042dcd4-41e6-a18d-3899-8f6d2696068a@suse.cz \
    --to=vbabka@suse.cz \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.co \
    --cc=kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lvqian@nfschina.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox