diff options
author | Ingo Molnar <mingo@elte.hu> | 2005-06-28 10:40:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-28 17:56:51 -0400 |
commit | f340c0d1a3f40fdcba69cd291530a4debc58748f (patch) | |
tree | 22fca5983aff6ce2aa7d4ede0b031666dfe1f28d /kernel/sched.c | |
parent | 082cf69eb82681f4eacb3a5653834c7970714bef (diff) |
[PATCH] Tweak idle thread setup semantics
This patch tweaks idle thread setup semantics a bit: instead of setting
NEED_RESCHED in init_idle(), we do an explicit schedule() before calling
into cpu_idle().
This patch, while having no negative side-effects, enables wider use of
cond_resched()s. (which might happen in the stock kernel too, but it's
particulary important for voluntary-preempt)
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 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index e2b0d3e4dd06..5f2182d42241 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4166,6 +4166,14 @@ void show_state(void) | |||
4166 | read_unlock(&tasklist_lock); | 4166 | read_unlock(&tasklist_lock); |
4167 | } | 4167 | } |
4168 | 4168 | ||
4169 | /** | ||
4170 | * init_idle - set up an idle thread for a given CPU | ||
4171 | * @idle: task in question | ||
4172 | * @cpu: cpu the idle task belongs to | ||
4173 | * | ||
4174 | * NOTE: this function does not set the idle thread's NEED_RESCHED | ||
4175 | * flag, to make booting more robust. | ||
4176 | */ | ||
4169 | void __devinit init_idle(task_t *idle, int cpu) | 4177 | void __devinit init_idle(task_t *idle, int cpu) |
4170 | { | 4178 | { |
4171 | runqueue_t *rq = cpu_rq(cpu); | 4179 | runqueue_t *rq = cpu_rq(cpu); |
@@ -4183,7 +4191,6 @@ void __devinit init_idle(task_t *idle, int cpu) | |||
4183 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) | 4191 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) |
4184 | idle->oncpu = 1; | 4192 | idle->oncpu = 1; |
4185 | #endif | 4193 | #endif |
4186 | set_tsk_need_resched(idle); | ||
4187 | spin_unlock_irqrestore(&rq->lock, flags); | 4194 | spin_unlock_irqrestore(&rq->lock, flags); |
4188 | 4195 | ||
4189 | /* Set the preempt count _outside_ the spinlocks! */ | 4196 | /* Set the preempt count _outside_ the spinlocks! */ |