aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/process.c')
-rw-r--r--arch/sparc/kernel/process.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index c39f4d01096d..ea8647411462 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -67,13 +67,6 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *);
67struct task_struct *last_task_used_math = NULL; 67struct task_struct *last_task_used_math = NULL;
68struct thread_info *current_set[NR_CPUS]; 68struct thread_info *current_set[NR_CPUS];
69 69
70/*
71 * default_idle is new in 2.5. XXX Review, currently stolen from sparc64.
72 */
73void default_idle(void)
74{
75}
76
77#ifndef CONFIG_SMP 70#ifndef CONFIG_SMP
78 71
79#define SUN4C_FAULT_HIGH 100 72#define SUN4C_FAULT_HIGH 100
@@ -92,12 +85,11 @@ void cpu_idle(void)
92 static unsigned long fps; 85 static unsigned long fps;
93 unsigned long now; 86 unsigned long now;
94 unsigned long faults; 87 unsigned long faults;
95 unsigned long flags;
96 88
97 extern unsigned long sun4c_kernel_faults; 89 extern unsigned long sun4c_kernel_faults;
98 extern void sun4c_grow_kernel_ring(void); 90 extern void sun4c_grow_kernel_ring(void);
99 91
100 local_irq_save(flags); 92 local_irq_disable();
101 now = jiffies; 93 now = jiffies;
102 count -= (now - last_jiffies); 94 count -= (now - last_jiffies);
103 last_jiffies = now; 95 last_jiffies = now;
@@ -113,13 +105,16 @@ void cpu_idle(void)
113 sun4c_grow_kernel_ring(); 105 sun4c_grow_kernel_ring();
114 } 106 }
115 } 107 }
116 local_irq_restore(flags); 108 local_irq_enable();
117 } 109 }
118 110
119 while((!need_resched()) && pm_idle) { 111 if (pm_idle) {
120 (*pm_idle)(); 112 while (!need_resched())
113 (*pm_idle)();
114 } else {
115 while (!need_resched())
116 cpu_relax();
121 } 117 }
122
123 preempt_enable_no_resched(); 118 preempt_enable_no_resched();
124 schedule(); 119 schedule();
125 preempt_disable(); 120 preempt_disable();
@@ -132,15 +127,15 @@ void cpu_idle(void)
132/* This is being executed in task 0 'user space'. */ 127/* This is being executed in task 0 'user space'. */
133void cpu_idle(void) 128void cpu_idle(void)
134{ 129{
130 set_thread_flag(TIF_POLLING_NRFLAG);
135 /* endless idle loop with no priority at all */ 131 /* endless idle loop with no priority at all */
136 while(1) { 132 while(1) {
137 if(need_resched()) { 133 while (!need_resched())
138 preempt_enable_no_resched(); 134 cpu_relax();
139 schedule(); 135 preempt_enable_no_resched();
140 preempt_disable(); 136 schedule();
141 check_pgt_cache(); 137 preempt_disable();
142 } 138 check_pgt_cache();
143 barrier(); /* or else gcc optimizes... */
144 } 139 }
145} 140}
146 141