Re: [PATCH] sched: Simplify cpu-hot-unplug task migration

From: Oleg Nesterov
Date: Wed Nov 17 2010 - 14:34:39 EST


Peter, sorry for delay.

I was going to read this patch carefully today, but due to the holiday
in the Czech Republic I have to drink (too much) beer instead ;)

This means you should probably ignore my question, but can't resist...

> -static void migrate_dead_tasks(unsigned int dead_cpu)
> -{
> - struct rq *rq = cpu_rq(dead_cpu);
> - struct task_struct *next;
> + rq->stop = NULL;

(or we could do current->state = TASK_INTERRUPTIPLE, afaics)

> for ( ; ; ) {
> - if (!rq->nr_running)
> + /*
> + * There's this thread running, bail when that's the only
> + * remaining thread.
> + */
> + if (rq->nr_running == 1)
> break;

I was very much confused, and I was going to say this is wrong.
However, now I think this is correct, just the comment is not
right.

There is another running thread we should not migrate, rq->idle.
If nothing else, dequeue_task_idle() should be never called.

But, if I understand correctly, ->nr_running does not account
the idle thread, and this is what makes this correct.

Correct?

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/