diff options
author | Nick Piggin <nickpiggin@yahoo.com.au> | 2005-11-09 00:39:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:56:33 -0500 |
commit | 5bfb5d690f36d316a5f3b4f7775fda996faa6b12 (patch) | |
tree | ea53f15293d1ddb49c316eb65df85e939a4f6e5e /arch/sh | |
parent | ede3d0fba99520f268067917b50858d788bc41da (diff) |
[PATCH] sched: disable preempt in idle tasks
Run idle threads with preempt disabled.
Also corrected a bugs in arm26's cpu_idle (make it actually call schedule()).
How did it ever work before?
Might fix the CPU hotplugging hang which Nigel Cunningham noted.
We think the bug hits if the idle thread is preempted after checking
need_resched() and before going to sleep, then the CPU offlined.
After calling stop_machine_run, the CPU eventually returns from preemption and
into the idle thread and goes to sleep. The CPU will continue executing
previous idle and have no chance to call play_dead.
By disabling preemption until we are ready to explicitly schedule, this bug is
fixed and the idle threads generally become more robust.
From: alexs <ashepard@u.washington.edu>
PPC build fix
From: Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
MIPS build fix
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/kernel/process.c | 2 | ||||
-rw-r--r-- | arch/sh/kernel/smp.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 6dce9d0b81f8..1cbc26b796ad 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c | |||
@@ -64,7 +64,9 @@ void default_idle(void) | |||
64 | cpu_sleep(); | 64 | cpu_sleep(); |
65 | } | 65 | } |
66 | 66 | ||
67 | preempt_enable_no_resched(); | ||
67 | schedule(); | 68 | schedule(); |
69 | preempt_disable(); | ||
68 | } | 70 | } |
69 | } | 71 | } |
70 | 72 | ||
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index 5ecefc02896a..59e49b18252c 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c | |||
@@ -112,7 +112,9 @@ int __cpu_up(unsigned int cpu) | |||
112 | 112 | ||
113 | int start_secondary(void *unused) | 113 | int start_secondary(void *unused) |
114 | { | 114 | { |
115 | unsigned int cpu = smp_processor_id(); | 115 | unsigned int cpu; |
116 | |||
117 | cpu = smp_processor_id(); | ||
116 | 118 | ||
117 | atomic_inc(&init_mm.mm_count); | 119 | atomic_inc(&init_mm.mm_count); |
118 | current->active_mm = &init_mm; | 120 | current->active_mm = &init_mm; |
@@ -120,6 +122,7 @@ int start_secondary(void *unused) | |||
120 | smp_store_cpu_info(cpu); | 122 | smp_store_cpu_info(cpu); |
121 | 123 | ||
122 | __smp_slave_init(cpu); | 124 | __smp_slave_init(cpu); |
125 | preempt_disable(); | ||
123 | per_cpu_trap_init(); | 126 | per_cpu_trap_init(); |
124 | 127 | ||
125 | atomic_inc(&cpus_booted); | 128 | atomic_inc(&cpus_booted); |