Re: [patch] sched: fix b5d9d734 blunder in task_new_fair()

From: Peter Zijlstra
Date: Thu Nov 26 2009 - 11:26:34 EST


On Sun, 2009-11-22 at 13:07 +0100, Mike Galbraith wrote:
> @@ -2589,16 +2588,10 @@ void sched_fork(struct task_struct *p, i
> */
> p->prio = current->normal_prio;
>
> - if (!rt_prio(p->prio))
> + if (!task_has_rt_policy(p))
> p->sched_class = &fair_sched_class;
>
> -#ifdef CONFIG_SMP
> - cpu = p->sched_class->select_task_rq(p, SD_BALANCE_FORK, 0);
> -#endif
> - local_irq_save(flags);
> - update_rq_clock(cpu_rq(cpu));
> - set_task_cpu(p, cpu);
> - local_irq_restore(flags);
> + __set_task_cpu(p, cpu);

OK, so I figured out why it was in sched_fork() and not in
wake_up_new_task().

It is because in sched_fork() the new task isn't in the tasklist yet and
can therefore not race with any other migration logic.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/