Re: [PATCH 1/3] will_become_orphaned_pgrp: we have threads

From: Oleg Nesterov
Date: Sun Dec 09 2007 - 11:42:36 EST


On 12/09, Eric W. Biederman wrote:
>
> Equally messed up is a our status in /proc at that point. Which
> says our sleeping process is a zombie.

Yes, this is annoying.

> I'm thinking we need to do at least some of the thread group leadership
> transfer in do_exit, instead of de_thread. Then p->group_leader->exit_state
> would be sufficient to see if the entire thread group was alive,
> as the group_leader would be whoever was left alive. The original
> group_leader might still need to be kept around for it's pid...
>
> I think that would solve most of the problems you have with a dead
> thread group leader and sending SIG_STOP as well.

Yes I was thinking about that too, but I am not brave enough to even
try to to think to the end ;)

As a minimal change, I tried to add "task_struct *leader_proxy" to
signal_struct, which points to the next live thread, and changed by
exit_notify(). eligible_child() checks it instead of ->exit_signal.
But this is so messy...

And in fact, if we are talking about group stop, it is a group operation,
why do_wait() uses per-thread ->exit_code but not ->group_exit_code ?

But yes, [PATCH 3/3] adds a visible difference, and I don't know if
this difference is good or bad.

$ sleep 1000

[1]+ Stopped sleep 1000
$ strace -p `pidof sleep`
Process 432 attached - interrupt to quit

Now strace "hangs" in do_wait() because ->exit_code was eaten by the
shell. We need SIGCONT.

With the "[PATCH 3/3]" strace proceeds happily.

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/