From: Michael Wang <wangyun@linux.vnet.ibm.com>
To: Michael Wang <wangyun@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
kjwinchester@gmail.com, borislav.petkov@amd.com,
ak@linux.intel.com, hpa@zytor.com, mingo@redhat.com,
tglx@linutronix.de
Subject: Re: [PATCH] x86: remove the useless branch in c_start()
Date: Wed, 26 Sep 2012 11:43:52 +0800 [thread overview]
Message-ID: <506279F8.10704@linux.vnet.ibm.com> (raw)
In-Reply-To: <1348033343-23658-1-git-send-email-wangyun@linux.vnet.ibm.com>
On 09/19/2012 01:42 PM, Michael Wang wrote:
> Since 'cpu == -1' in cpumask_next() is legal, no need to handle '*pos == 0'
> specially.
>
> About the comments:
> /* just in case, cpu 0 is not the first */
> A test with a cpumask in which cpu 0 is not the first has been done, and it
> works well.
Could I get some comments on this patch?
Regards,
Michael Wang
>
> This patch will remove that useless branch to clean the code.
>
> Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
> ---
> arch/x86/kernel/cpu/proc.c | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
> index 8022c66..fbd8955 100644
> --- a/arch/x86/kernel/cpu/proc.c
> +++ b/arch/x86/kernel/cpu/proc.c
> @@ -140,10 +140,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
>
> static void *c_start(struct seq_file *m, loff_t *pos)
> {
> - if (*pos == 0) /* just in case, cpu 0 is not the first */
> - *pos = cpumask_first(cpu_online_mask);
> - else
> - *pos = cpumask_next(*pos - 1, cpu_online_mask);
> + *pos = cpumask_next(*pos - 1, cpu_online_mask);
> if ((*pos) < nr_cpu_ids)
> return &cpu_data(*pos);
> return NULL;
>
next parent reply other threads:[~2012-09-26 3:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1348033343-23658-1-git-send-email-wangyun@linux.vnet.ibm.com>
2012-09-26 3:43 ` Michael Wang [this message]
2012-09-26 13:02 ` [PATCH] x86: remove the useless branch in c_start() Borislav Petkov
2012-09-27 2:29 ` Michael Wang
2012-09-27 6:07 ` [tip:x86/cpu] x86: Remove " tip-bot for Michael Wang
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=506279F8.10704@linux.vnet.ibm.com \
--to=wangyun@linux.vnet.ibm.com \
--cc=ak@linux.intel.com \
--cc=borislav.petkov@amd.com \
--cc=hpa@zytor.com \
--cc=kjwinchester@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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