From: Tycho Andersen <tycho@tycho.pizza>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Christian Brauner <brauner@kernel.org>,
"Eric W . Biederman" <ebiederm@xmission.com>,
linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
Tycho Andersen <tandersen@netflix.com>
Subject: Re: [RFC 1/3] pidfd: allow pidfd_open() on non-thread-group leaders
Date: Thu, 30 Nov 2023 10:56:58 -0700 [thread overview]
Message-ID: <ZWjM6trZ6uw6yBza@tycho.pizza> (raw)
In-Reply-To: <20231130173938.GA21808@redhat.com>
On Thu, Nov 30, 2023 at 06:39:39PM +0100, Oleg Nesterov wrote:
> Hi Tycho,
>
> I can't really read this patch now, possibly I am wrong, but...
No worries, no rush here.
> On 11/30, Tycho Andersen wrote:
> >
> > @@ -263,16 +263,25 @@ void release_task(struct task_struct *p)
> > */
> > zap_leader = 0;
> > leader = p->group_leader;
> > - if (leader != p && thread_group_empty(leader)
> > - && leader->exit_state == EXIT_ZOMBIE) {
> > - /*
> > - * If we were the last child thread and the leader has
> > - * exited already, and the leader's parent ignores SIGCHLD,
> > - * then we are the one who should release the leader.
> > - */
> > - zap_leader = do_notify_parent(leader, leader->exit_signal);
> > - if (zap_leader)
> > - leader->exit_state = EXIT_DEAD;
> > + if (leader != p) {
> > + if (thread_group_empty(leader)
> > + && leader->exit_state == EXIT_ZOMBIE) {
> > + /*
> > + * If we were the last child thread and the leader has
> > + * exited already, and the leader's parent ignores SIGCHLD,
> > + * then we are the one who should release the leader.
> > + */
> > + zap_leader = do_notify_parent(leader,
> > + leader->exit_signal);
> > + if (zap_leader)
> > + leader->exit_state = EXIT_DEAD;
> > + } else {
> > + /*
> > + * wake up pidfd pollers anyway, they want to know this
> > + * thread is dying.
> > + */
> > + wake_up_all(&thread_pid->wait_pidfd);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> somehow I can't believe this is a good change after a quick glance ;)
Yeah, I figured it would raise some eyebrows :)
> I think that wake_up_all(wait_pidfd) should have a single caller,
> do_notify_pidfd(). This probably means it should be shiftef from
> do_notify_parent() to exit_notify(), I am not sure...
__exit_signals() is what I was thinking in the patch description, but
I'll look at exit_notify() too.
Tycho
next prev parent reply other threads:[~2023-11-30 17:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 16:39 [RFC 1/3] pidfd: allow pidfd_open() on non-thread-group leaders Tycho Andersen
2023-11-30 16:39 ` [RFC 2/3] selftests/pidfd: add non-thread-group leader tests Tycho Andersen
2023-11-30 16:39 ` [RFC 3/3] clone: allow CLONE_THREAD | CLONE_PIDFD together Tycho Andersen
2023-11-30 17:39 ` [RFC 1/3] pidfd: allow pidfd_open() on non-thread-group leaders Oleg Nesterov
2023-11-30 17:56 ` Tycho Andersen [this message]
2023-12-01 16:31 ` Tycho Andersen
2023-12-07 17:57 ` Christian Brauner
2023-12-07 21:25 ` Christian Brauner
2023-12-08 20:04 ` Tycho Andersen
2023-11-30 18:37 ` Florian Weimer
2023-11-30 18:54 ` Tycho Andersen
2023-11-30 19:00 ` Mathieu Desnoyers
2023-11-30 19:17 ` Tycho Andersen
2023-11-30 19:43 ` Florian Weimer
2023-12-06 15:27 ` Tycho Andersen
2023-12-07 22:58 ` Christian Brauner
2023-12-08 3:16 ` Jens Axboe
2023-12-08 13:15 ` Florian Weimer
2023-12-08 13:48 ` Christian Brauner
2023-12-08 13:58 ` Florian Weimer
2023-12-07 17:21 ` Christian Brauner
2023-12-07 17:52 ` Tycho Andersen
2023-12-08 17:47 ` Jan Kara
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZWjM6trZ6uw6yBza@tycho.pizza \
--to=tycho@tycho.pizza \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=tandersen@netflix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).