All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] x86: remove the useless branch in c_start()
       [not found] <1348033343-23658-1-git-send-email-wangyun@linux.vnet.ibm.com>
@ 2012-09-26  3:43 ` Michael Wang
  2012-09-26 13:02   ` Borislav Petkov
  2012-09-27  6:07 ` [tip:x86/cpu] x86: Remove " tip-bot for Michael Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Wang @ 2012-09-26  3:43 UTC (permalink / raw)
  To: Michael Wang
  Cc: linux-kernel, x86, kjwinchester, borislav.petkov, ak, hpa, mingo,
	tglx

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;
> 


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

* Re: [PATCH] x86: remove the useless branch in c_start()
  2012-09-26  3:43 ` [PATCH] x86: remove the useless branch in c_start() Michael Wang
@ 2012-09-26 13:02   ` Borislav Petkov
  2012-09-27  2:29     ` Michael Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2012-09-26 13:02 UTC (permalink / raw)
  To: Michael Wang; +Cc: linux-kernel, x86, kjwinchester, ak, hpa, mingo, tglx

On Wed, Sep 26, 2012 at 11:43:52AM +0800, Michael Wang wrote:
> 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?

Looks ok to me:

Acked-by: Borislav Petkov <borislav.petkov@amd.com>

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

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

* Re: [PATCH] x86: remove the useless branch in c_start()
  2012-09-26 13:02   ` Borislav Petkov
@ 2012-09-27  2:29     ` Michael Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Wang @ 2012-09-27  2:29 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: linux-kernel, x86, kjwinchester, ak, hpa, mingo, tglx

On 09/26/2012 09:02 PM, Borislav Petkov wrote:
> On Wed, Sep 26, 2012 at 11:43:52AM +0800, Michael Wang wrote:
>> 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?
> 
> Looks ok to me:
> 
> Acked-by: Borislav Petkov <borislav.petkov@amd.com>
> 
> Thanks.

Thanks for your review.

Regards,
Michael Wang
> 


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

* [tip:x86/cpu] x86: Remove the useless branch in c_start()
       [not found] <1348033343-23658-1-git-send-email-wangyun@linux.vnet.ibm.com>
  2012-09-26  3:43 ` [PATCH] x86: remove the useless branch in c_start() Michael Wang
@ 2012-09-27  6:07 ` tip-bot for Michael Wang
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Michael Wang @ 2012-09-27  6:07 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, wangyun, tglx

Commit-ID:  dec08a837fda146fee498ffc5ecd0d2eeeacd025
Gitweb:     http://git.kernel.org/tip/dec08a837fda146fee498ffc5ecd0d2eeeacd025
Author:     Michael Wang <wangyun@linux.vnet.ibm.com>
AuthorDate: Wed, 19 Sep 2012 13:42:23 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 26 Sep 2012 13:27:56 +0200

x86: Remove the useless branch in c_start()

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.

This patch will remove that useless branch to clean the code.

Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
Cc: kjwinchester@gmail.com
Cc: borislav.petkov@amd.com
Cc: ak@linux.intel.com
Link: http://lkml.kernel.org/r/1348033343-23658-1-git-send-email-wangyun@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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;

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

end of thread, other threads:[~2012-09-27  6:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1348033343-23658-1-git-send-email-wangyun@linux.vnet.ibm.com>
2012-09-26  3:43 ` [PATCH] x86: remove the useless branch in c_start() Michael Wang
2012-09-26 13:02   ` Borislav Petkov
2012-09-27  2:29     ` Michael Wang
2012-09-27  6:07 ` [tip:x86/cpu] x86: Remove " tip-bot for Michael Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.