Commit 06b83b5f authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched: Use TASK_WAKING for fork wakups

For later convenience use TASK_WAKING for fresh tasks.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <20091216170517.732561278@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent e4f42888
...@@ -2540,14 +2540,6 @@ static void __sched_fork(struct task_struct *p) ...@@ -2540,14 +2540,6 @@ static void __sched_fork(struct task_struct *p)
#ifdef CONFIG_PREEMPT_NOTIFIERS #ifdef CONFIG_PREEMPT_NOTIFIERS
INIT_HLIST_HEAD(&p->preempt_notifiers); INIT_HLIST_HEAD(&p->preempt_notifiers);
#endif #endif
/*
* We mark the process as running here, but have not actually
* inserted it onto the runqueue yet. This guarantees that
* nobody will actually run it, and a signal or other external
* event cannot wake it up and insert it on the runqueue either.
*/
p->state = TASK_RUNNING;
} }
/* /*
...@@ -2558,6 +2550,12 @@ void sched_fork(struct task_struct *p, int clone_flags) ...@@ -2558,6 +2550,12 @@ void sched_fork(struct task_struct *p, int clone_flags)
int cpu = get_cpu(); int cpu = get_cpu();
__sched_fork(p); __sched_fork(p);
/*
* We mark the process as waking here. This guarantees that
* nobody will actually run it, and a signal or other external
* event cannot wake it up and insert it on the runqueue either.
*/
p->state = TASK_WAKING;
/* /*
* Revert to default priority/policy on fork if requested. * Revert to default priority/policy on fork if requested.
...@@ -2626,7 +2624,8 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags) ...@@ -2626,7 +2624,8 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
struct rq *rq; struct rq *rq;
rq = task_rq_lock(p, &flags); rq = task_rq_lock(p, &flags);
BUG_ON(p->state != TASK_RUNNING); BUG_ON(p->state != TASK_WAKING);
p->state = TASK_RUNNING;
update_rq_clock(rq); update_rq_clock(rq);
activate_task(rq, p, 0); activate_task(rq, p, 0);
trace_sched_wakeup_new(rq, p, 1); trace_sched_wakeup_new(rq, p, 1);
...@@ -6984,6 +6983,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) ...@@ -6984,6 +6983,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
raw_spin_lock_irqsave(&rq->lock, flags); raw_spin_lock_irqsave(&rq->lock, flags);
__sched_fork(idle); __sched_fork(idle);
idle->state = TASK_RUNNING;
idle->se.exec_start = sched_clock(); idle->se.exec_start = sched_clock();
cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment