Re: [PATCH 3/4] scheduler: replace migration_thread with cpuhog

From: Oleg Nesterov
Date: Mon Mar 29 2010 - 09:59:52 EST


As I said, personally I like these changes very much. Even if I can't ack them
I'd like to add my vote.

On 03/17, Tejun Heo wrote:
>
> int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
> {
> ...
> + if (migrate_task(p, dest_cpu)) {
> + struct migration_arg arg = { p, dest_cpu };
> /* Need help from migration thread: drop lock and wait. */
> - struct task_struct *mt = rq->migration_thread;
> -
> - get_task_struct(mt);
> task_rq_unlock(rq, &flags);
> - wake_up_process(rq->migration_thread);
> - put_task_struct(mt);
> - wait_for_completion(&req.done);
> + hog_one_cpu(cpu_of(rq), migration_hog, &arg);

Afaics, this is the only change which can make a difference. If we race with
cpu_down(), set_cpus_allowed_ptr() can return before the task was actually
moved to another CPU. But this seems harmless to me.

Oleg.

--
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/