aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/idle.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64/kernel/idle.c')
-rw-r--r--arch/ppc64/kernel/idle.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c
index 8fec27469802..715bc0e71e0f 100644
--- a/arch/ppc64/kernel/idle.c
+++ b/arch/ppc64/kernel/idle.c
@@ -34,15 +34,11 @@ extern void power4_idle(void);
34 34
35void default_idle(void) 35void default_idle(void)
36{ 36{
37 long oldval;
38 unsigned int cpu = smp_processor_id(); 37 unsigned int cpu = smp_processor_id();
38 set_thread_flag(TIF_POLLING_NRFLAG);
39 39
40 while (1) { 40 while (1) {
41 oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); 41 if (!need_resched()) {
42
43 if (!oldval) {
44 set_thread_flag(TIF_POLLING_NRFLAG);
45
46 while (!need_resched() && !cpu_is_offline(cpu)) { 42 while (!need_resched() && !cpu_is_offline(cpu)) {
47 ppc64_runlatch_off(); 43 ppc64_runlatch_off();
48 44
@@ -55,13 +51,12 @@ void default_idle(void)
55 } 51 }
56 52
57 HMT_medium(); 53 HMT_medium();
58 clear_thread_flag(TIF_POLLING_NRFLAG);
59 } else {
60 set_need_resched();
61 } 54 }
62 55
63 ppc64_runlatch_on(); 56 ppc64_runlatch_on();
57 preempt_enable_no_resched();
64 schedule(); 58 schedule();
59 preempt_disable();
65 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) 60 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
66 cpu_die(); 61 cpu_die();
67 } 62 }
@@ -77,7 +72,9 @@ void native_idle(void)
77 72
78 if (need_resched()) { 73 if (need_resched()) {
79 ppc64_runlatch_on(); 74 ppc64_runlatch_on();
75 preempt_enable_no_resched();
80 schedule(); 76 schedule();
77 preempt_disable();
81 } 78 }
82 79
83 if (cpu_is_offline(smp_processor_id()) && 80 if (cpu_is_offline(smp_processor_id()) &&