diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-06-09 10:59:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-10 09:52:01 -0400 |
commit | 6ddd2a27948f0bd02a2ad001e8a6816898eba0dc (patch) | |
tree | 4a9a8b4d1186bb5a03df6c26f23d4a4a8ba6f7bd /arch/x86 | |
parent | 9e26d84273541a8c6c2efb705457ca8e6245fb73 (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')
-rw-r--r-- | arch/x86/kernel/process.c | 18 | ||||
-rw-r--r-- | arch/x86/kernel/process_32.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/process_64.c | 7 |
3 files changed, 10 insertions, 22 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 | ||
140 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) | 140 | void __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 | ||
165 | static int __init idle_setup(char *str) | 161 | static int __init idle_setup(char *str) |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index f8476dfbb60d..ee4ab461c50d 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -168,24 +168,19 @@ void cpu_idle(void) | |||
168 | while (1) { | 168 | while (1) { |
169 | tick_nohz_stop_sched_tick(); | 169 | tick_nohz_stop_sched_tick(); |
170 | while (!need_resched()) { | 170 | while (!need_resched()) { |
171 | void (*idle)(void); | ||
172 | 171 | ||
173 | check_pgt_cache(); | 172 | check_pgt_cache(); |
174 | rmb(); | 173 | rmb(); |
175 | idle = pm_idle; | ||
176 | 174 | ||
177 | if (rcu_pending(cpu)) | 175 | if (rcu_pending(cpu)) |
178 | rcu_check_callbacks(cpu, 0); | 176 | rcu_check_callbacks(cpu, 0); |
179 | 177 | ||
180 | if (!idle) | ||
181 | idle = default_idle; | ||
182 | |||
183 | if (cpu_is_offline(cpu)) | 178 | if (cpu_is_offline(cpu)) |
184 | play_dead(); | 179 | play_dead(); |
185 | 180 | ||
186 | local_irq_disable(); | 181 | local_irq_disable(); |
187 | __get_cpu_var(irq_stat).idle_timestamp = jiffies; | 182 | __get_cpu_var(irq_stat).idle_timestamp = jiffies; |
188 | idle(); | 183 | pm_idle(); |
189 | } | 184 | } |
190 | tick_nohz_restart_sched_tick(); | 185 | tick_nohz_restart_sched_tick(); |
191 | preempt_enable_no_resched(); | 186 | preempt_enable_no_resched(); |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index e2319f39988b..db3d89a04399 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -150,12 +150,9 @@ void cpu_idle(void) | |||
150 | while (1) { | 150 | while (1) { |
151 | tick_nohz_stop_sched_tick(); | 151 | tick_nohz_stop_sched_tick(); |
152 | while (!need_resched()) { | 152 | while (!need_resched()) { |
153 | void (*idle)(void); | ||
154 | 153 | ||
155 | rmb(); | 154 | rmb(); |
156 | idle = pm_idle; | 155 | |
157 | if (!idle) | ||
158 | idle = default_idle; | ||
159 | if (cpu_is_offline(smp_processor_id())) | 156 | if (cpu_is_offline(smp_processor_id())) |
160 | play_dead(); | 157 | play_dead(); |
161 | /* | 158 | /* |
@@ -165,7 +162,7 @@ void cpu_idle(void) | |||
165 | */ | 162 | */ |
166 | local_irq_disable(); | 163 | local_irq_disable(); |
167 | enter_idle(); | 164 | enter_idle(); |
168 | idle(); | 165 | pm_idle(); |
169 | /* In many cases the interrupt that ended idle | 166 | /* In many cases the interrupt that ended idle |
170 | has already called exit_idle. But some idle | 167 | has already called exit_idle. But some idle |
171 | loops can be woken up without interrupt. */ | 168 | loops can be woken up without interrupt. */ |