[PATCH 08/27] m32r: Fix horrible logic in smp_prepare_cpus()

From
Srivatsa S. Bhat <hidden>
Date
2012-06-01 09:13:13
Also in
lkml
Reply to
Srivatsa S. Bhat, 2012-06-01
In smp_prepare_cpus(), after max_cpus are booted, instead of breaking
from the loop, the 'continue' statement is used which results in unnecessarily
wasting time by looping NR_CPUS times!

Many things around this could be pulled into generic code in the future, but
for now, fix this particular piece of code locally (because I am unable to
convince myself to ignore it even temporarily, given that it is such a gem!).

And also rewrite the 'if' statement in a more natural way.

Cc: Hirokazu Takata <redacted>
Cc: Thomas Gleixner <redacted>
Cc: <redacted>
Cc: <redacted>
Signed-off-by: Srivatsa S. Bhat <redacted>
---

 arch/m32r/kernel/smpboot.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index a2cfc0a..6ddc51a 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -209,8 +209,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 		if (!physid_isset(phys_id, phys_cpu_present_map))
 			continue;
 
-		if (max_cpus <= cpucount + 1)
-			continue;
+		if (cpucount + 1 >= max_cpus)
+			break;
 
 		do_boot_cpu(phys_id);
 
Thread (81 messages) 81 messages, 12 authors, last reply 2012-06-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help