LKML Archive on
help / color / mirror / Atom feed
From: Oleg Nesterov <>
To: Roland McGrath <>
Cc: Andrew Morton <>,
	Alan Cox <>,
	Davide Libenzi <>,
	"Eric W. Biederman" <>,
	Ingo Molnar <>,
	Linus Torvalds <>,
Subject: Re: [PATCH 0/3] orphaned pgrp fixes
Date: Wed, 5 Mar 2008 20:11:09 +0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <20080304122654.7313227010A@magilla.localdomain>

On 03/04, Roland McGrath wrote:
> What seems most pedantically right for this check is:
> 		is_my_init(p, p->real_parent)
> i.e.
> 		if (task_session(p->real_parent) == task_session(p) &&
> 		    task_pgrp(p->real_parent) != pgrp &&
> 		    task_tgid_nr_ns(p->real_parent, p->nsproxy->pid_ns) != 1)
> 			return 0;
> It's excluded from counting as in your session if you consider to to be init.

Yes. Not that I really understand ;) But Eric also suggested to use

> The write lock on
> tasklist_lock strictly serializes all exiting process's calls from
> exit_notify.  This call is after group_dead hits.  If some other
> process in the pgrp has ->signal->live > 0 then it has not exited yet
> and when it does it will do this same check, guaranteed to be after
> ours, and after our ->signal->live == 0.

Yes. I though about that too. But, unlike ->exit_state, signal->live
is not protected by tasklist, please see below.

> Since it's after our own
> group_dead hit, the "ignored_task" check for our own group leader is
> redundant with that.

Ah, good point. I didn't realize this when I was thinking about using

So perhaps it's:
> 	do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
> 		if (task_session(p->real_parent) == task_session(p) &&
> 		    task_pgrp(p->real_parent) != pgrp &&
>  		    atomic_read(&p->signal->live) > 0 &&
> 		    task_tgid_nr_ns(p->real_parent, p->nsproxy->pid_ns) != 1)
> 			return 0;
> 	} while_each_pid_task(pgrp, PIDTYPE_PGID, p);

I am hopeless, I can't understand orphaned pgrps.

But still. Let's suppose that pgrp should be considered as orphaned when
2 tasks A and B exit. They both exit at the same time and decrement ->live
down to zero. Now, they both can send SIGHUP to the stopped tasks.


That said. Even if I am right, I agree that the signal->live check is
better. I like very much the possibility to kill the ugly "ignored_task".

> Now, about has_stopped_jobs.  It's a waste for it to be a separate loop
> across the pgrp just after we did one in will_become_orphaned_pgrp.  They
> should be merged together.

Yes sure. Looking at the code I was surprised why we don't do that.


  parent reply	other threads:[~2008-03-05 17:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-02 18:44 Oleg Nesterov
2008-03-04 12:26 ` Roland McGrath
2008-03-04 15:51   ` Oleg Nesterov
2008-03-05  1:11     ` Roland McGrath
2008-03-05 16:48       ` Oleg Nesterov
2008-03-05 17:11   ` Oleg Nesterov [this message]
2008-03-06  1:14     ` Eric W. Biederman
2008-03-07  1:52       ` Oleg Nesterov
2008-03-07  3:53     ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH 0/3] orphaned pgrp fixes' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).