aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2005-01-07 21:53:41 -0800
committerLinus Torvalds <torvalds@evo.osdl.org>2005-01-07 21:53:41 -0800
commitdd9baec372177c2575d4f4ad69f5ae8df67ef1e7 (patch)
treef0a12c60b9a716de5a09ddc0b7e4f73d85125e60 /init
parent2b5726db9f5d0583eaad993c5a0b99355bf05a20 (diff)
downloadhistory-dd9baec372177c2575d4f4ad69f5ae8df67ef1e7.tar.gz
[PATCH] idle thread preemption fix
The early bootup stage is pretty fragile because the idle thread is not yet functioning as such and so we need preemption disabled. Whether the bootup fails or not seems to depend on timing details so e.g. the presence of SCHED_SMT makes it go away. Disabling preemption explicitly has another advantage: the atomicity check in schedule() will catch early-bootup schedule() calls from now on. The patch also fixes another preempt-bkl buglet: interrupt-driven forced-preemption didnt go through preempt_schedule() so it resulted in auto-dropping of the BKL. Now we go through preempt_schedule() which properly deals with the BKL. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'init')
-rw-r--r--init/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/init/main.c b/init/main.c
index 6eaeffde35f6fd..af4f0a75c8a5ea 100644
--- a/init/main.c
+++ b/init/main.c
@@ -373,6 +373,12 @@ static void noinline rest_init(void)
{
kernel_thread(init, NULL, CLONE_FS | CLONE_SIGHAND);
numa_default_policy();
+ /*
+ * Re-enable preemption but disable interrupts to make sure
+ * we dont get preempted until we schedule() in cpu_idle().
+ */
+ local_irq_disable();
+ preempt_enable_no_resched();
unlock_kernel();
cpu_idle();
}
@@ -438,6 +444,7 @@ asmlinkage void __init start_kernel(void)
* time - but meanwhile we still have a functioning scheduler.
*/
sched_init();
+ preempt_disable();
build_all_zonelists();
page_alloc_init();
printk("Kernel command line: %s\n", saved_command_line);