aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/process.c')
-rw-r--r--arch/i386/kernel/process.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index bea304d48cdb..393a67d5d943 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -49,7 +49,6 @@
49#include <asm/i387.h> 49#include <asm/i387.h>
50#include <asm/desc.h> 50#include <asm/desc.h>
51#include <asm/vm86.h> 51#include <asm/vm86.h>
52#include <asm/idle.h>
53#ifdef CONFIG_MATH_EMULATION 52#ifdef CONFIG_MATH_EMULATION
54#include <asm/math_emu.h> 53#include <asm/math_emu.h>
55#endif 54#endif
@@ -82,42 +81,6 @@ void (*pm_idle)(void);
82EXPORT_SYMBOL(pm_idle); 81EXPORT_SYMBOL(pm_idle);
83static DEFINE_PER_CPU(unsigned int, cpu_idle_state); 82static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
84 83
85static ATOMIC_NOTIFIER_HEAD(idle_notifier);
86
87void idle_notifier_register(struct notifier_block *n)
88{
89 atomic_notifier_chain_register(&idle_notifier, n);
90}
91
92void idle_notifier_unregister(struct notifier_block *n)
93{
94 atomic_notifier_chain_unregister(&idle_notifier, n);
95}
96
97static DEFINE_PER_CPU(volatile unsigned long, idle_state);
98
99void enter_idle(void)
100{
101 /* needs to be atomic w.r.t. interrupts, not against other CPUs */
102 __set_bit(0, &__get_cpu_var(idle_state));
103 atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
104}
105
106static void __exit_idle(void)
107{
108 /* needs to be atomic w.r.t. interrupts, not against other CPUs */
109 if (__test_and_clear_bit(0, &__get_cpu_var(idle_state)) == 0)
110 return;
111 atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
112}
113
114void exit_idle(void)
115{
116 if (current->pid)
117 return;
118 __exit_idle();
119}
120
121void disable_hlt(void) 84void disable_hlt(void)
122{ 85{
123 hlt_counter++; 86 hlt_counter++;
@@ -168,7 +131,6 @@ EXPORT_SYMBOL(default_idle);
168 */ 131 */
169static void poll_idle (void) 132static void poll_idle (void)
170{ 133{
171 local_irq_enable();
172 cpu_relax(); 134 cpu_relax();
173} 135}
174 136
@@ -229,16 +191,7 @@ void cpu_idle(void)
229 play_dead(); 191 play_dead();
230 192
231 __get_cpu_var(irq_stat).idle_timestamp = jiffies; 193 __get_cpu_var(irq_stat).idle_timestamp = jiffies;
232
233 /*
234 * Idle routines should keep interrupts disabled
235 * from here on, until they go to idle.
236 * Otherwise, idle callbacks can misfire.
237 */
238 local_irq_disable();
239 enter_idle();
240 idle(); 194 idle();
241 __exit_idle();
242 } 195 }
243 tick_nohz_restart_sched_tick(); 196 tick_nohz_restart_sched_tick();
244 preempt_enable_no_resched(); 197 preempt_enable_no_resched();
@@ -293,11 +246,7 @@ void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
293 __monitor((void *)&current_thread_info()->flags, 0, 0); 246 __monitor((void *)&current_thread_info()->flags, 0, 0);
294 smp_mb(); 247 smp_mb();
295 if (!need_resched()) 248 if (!need_resched())
296 __sti_mwait(eax, ecx); 249 __mwait(eax, ecx);
297 else
298 local_irq_enable();
299 } else {
300 local_irq_enable();
301 } 250 }
302} 251}
303 252