[PATCH 16/27] mn10300: Fix horrible logic in smp_prepare_cpus()
From: Srivatsa S. Bhat <hidden>
Date: 2012-06-01 09:57:09
Also in:
lkml
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Srivatsa S. Bhat <hidden>
Date: 2012-06-01 09:57:09
Also in:
lkml
Subsystem:
the rest · Maintainer:
Linus Torvalds
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: David Howells <dhowells@redhat.com> Cc: Koichi Yasutake <redacted> Cc: Thomas Gleixner <redacted> Cc: Yong Zhang <redacted> Cc: linux-am33-list@redhat.com Signed-off-by: Srivatsa S. Bhat <redacted> --- arch/mn10300/kernel/smp.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c
index e62c223..b19e75d2 100644
--- a/arch/mn10300/kernel/smp.c
+++ b/arch/mn10300/kernel/smp.c@@ -695,9 +695,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus) /* Boot secondary CPUs (for which phy_id > 0) */ for (phy_id = 0; phy_id < NR_CPUS; phy_id++) { + if (cpucount + 1 >= max_cpus) + break; /* Don't boot primary CPU */ - if (max_cpus <= cpucount + 1) - continue; if (phy_id != 0) do_boot_cpu(phy_id); set_cpu_possible(phy_id, true);