From c2ba4e3ca06e65958453dfe8d15a73b1aa1a5feb Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 6 Mar 2002 00:25:30 -0800 Subject: [PATCH] Kernel lock exclusion is actually needed in the boot sequence, so we need to make init_idle() aware of it so that it gets the preempt_count initialization right. --- init/main.c | 3 +-- kernel/sched.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/init/main.c b/init/main.c index b655eba636d6..e5f17bfb5c98 100644 --- a/init/main.c +++ b/init/main.c @@ -338,6 +338,7 @@ asmlinkage void __init start_kernel(void) * Interrupts are still disabled. Do necessary setups, then * enable them */ + lock_kernel(); printk(linux_banner); setup_arch(&command_line); setup_per_cpu_areas(); @@ -405,8 +406,6 @@ asmlinkage void __init start_kernel(void) init_idle(current, smp_processor_id()); - lock_kernel(); - /* * We count on the initial thread going ok * Like idlers init is an unlocked kernel thread, which will diff --git a/kernel/sched.c b/kernel/sched.c index bb0776d23902..81190071b159 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1438,7 +1438,7 @@ void __init init_idle(task_t *idle, int cpu) idle->prio = MAX_PRIO; idle->state = TASK_RUNNING; idle->thread_info->cpu = cpu; - idle->thread_info->preempt_count = 0; + idle->thread_info->preempt_count = (idle->lock_depth >= 0); double_rq_unlock(idle_rq, rq); set_tsk_need_resched(idle); __restore_flags(flags); -- 2.39.5