linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch: sparc: kernel: smp_64.c:  Optimization of the Code
@ 2014-06-01 21:48 Rickard Strandqvist
  2014-06-02  1:52 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-06-01 21:48 UTC (permalink / raw)
  To: David S. Miller, Kirill Tkhai
  Cc: Rickard Strandqvist, Paul Gortmaker, Peter Zijlstra,
	Bjorn Helgaas, sparclinux, linux-kernel

>From what I know, AND is faster then modulo.
Not sure if this is worth changing though.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 arch/sparc/kernel/smp_64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 745a363..921d924 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -179,7 +179,7 @@ static inline long get_delta (long *rt, long *master)
 
 	/* average best_t0 and best_t1 without overflow: */
 	tcenter = (best_t0/2 + best_t1/2);
-	if (best_t0 % 2 + best_t1 % 2 == 2)
+	if ((best_t0 & 1) + (best_t1 & 1) == 2)
 		tcenter++;
 	return tcenter - best_tm;
 }
-- 
1.7.10.4


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

* Re: [PATCH] arch: sparc: kernel: smp_64.c: Optimization of the Code
  2014-06-01 21:48 [PATCH] arch: sparc: kernel: smp_64.c: Optimization of the Code Rickard Strandqvist
@ 2014-06-02  1:52 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-06-02  1:52 UTC (permalink / raw)
  To: rickard_strandqvist
  Cc: tkhai, paul.gortmaker, peterz, bhelgaas, sparclinux, linux-kernel

From: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Date: Sun,  1 Jun 2014 23:48:18 +0200

> From what I know, AND is faster then modulo.
> Not sure if this is worth changing though.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

This code came from the IA-64 arch code, so you probably want to
fix either both or neither.

I'd say neither, this is not a performance critical path and the
intent is clearer when expressed as a modulus.

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

end of thread, other threads:[~2014-06-02  1:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-01 21:48 [PATCH] arch: sparc: kernel: smp_64.c: Optimization of the Code Rickard Strandqvist
2014-06-02  1:52 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).