Re: [RFC,PATCH 5/5] exec: RT sub-thread can livelock and monopolize CPU on exec

From: Oleg Nesterov
Date: Sun Aug 19 2007 - 16:10:55 EST


On 08/19, Roland McGrath wrote:
>
> > The group_leader can sleep before it enters exit_notify(). In that case
> > wait_task_inactive() returns, and we still need some polling to wait for
> > EXIT_ZOMBIE.
>
> It could be a loop as now with yield. It's still polling, but only one
> poll per wakeup of the target.

I guess I misunderstand you. Do you mean

de_thread:

/*
* Wait for the thread group leader to be a zombie.
* It should already be zombie at this point, most
* of the time.
*/
while (leader->exit_state != EXIT_ZOMBIE)
wait_task_inactive(leader);

? This becomes a busy-wait loop if the leader sleeps, wait_task_inactive()
doesn't sleep/yield in this case. Not good.

> > Yes sure. But in any case I think we should avoid polling, we need some
> > notification from exit_notify().
>
> Indeed.

This means we should put something in exit_notify(), like this patch does.
It could be simplified a bit, we don't in fact need a negative ->notify_count,
we can tolerate a false wakeup. We can even skip the "thread_group_leader()"
check for the same reason.

(Of course, we can also add wait_queue_head_t to ->signal, but I don't think
you have this in mind).

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/