aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-06-09 10:59:53 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-10 09:52:01 -0400
commit6ddd2a27948f0bd02a2ad001e8a6816898eba0dc (patch)
tree4a9a8b4d1186bb5a03df6c26f23d4a4a8ba6f7bd /arch/x86/kernel/process.c
parent9e26d84273541a8c6c2efb705457ca8e6245fb73 (diff)
x86: simplify idle selection
default_idle is selected in cpu_idle(), when no other idle routine is selected. Select it in select_idle_routine() when mwait is not selected. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r--arch/x86/kernel/process.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index ba370dc8685b..b3078f4ce25b 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -139,27 +139,23 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
139 139
140void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 140void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
141{ 141{
142 static int selected;
143
144 if (selected)
145 return;
146#ifdef CONFIG_X86_SMP 142#ifdef CONFIG_X86_SMP
147 if (pm_idle == poll_idle && smp_num_siblings > 1) { 143 if (pm_idle == poll_idle && smp_num_siblings > 1) {
148 printk(KERN_WARNING "WARNING: polling idle and HT enabled," 144 printk(KERN_WARNING "WARNING: polling idle and HT enabled,"
149 " performance may degrade.\n"); 145 " performance may degrade.\n");
150 } 146 }
151#endif 147#endif
148 if (pm_idle)
149 return;
150
152 if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) { 151 if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) {
153 /* 152 /*
154 * Skip, if setup has overridden idle.
155 * One CPU supports mwait => All CPUs supports mwait 153 * One CPU supports mwait => All CPUs supports mwait
156 */ 154 */
157 if (!pm_idle) { 155 printk(KERN_INFO "using mwait in idle threads.\n");
158 printk(KERN_INFO "using mwait in idle threads.\n"); 156 pm_idle = mwait_idle;
159 pm_idle = mwait_idle; 157 } else
160 } 158 pm_idle = default_idle;
161 }
162 selected = 1;
163} 159}
164 160
165static int __init idle_setup(char *str) 161static int __init idle_setup(char *str)