[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231130173938.GA21808@redhat.com>
Date: Thu, 30 Nov 2023 18:39:39 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Tycho Andersen <tycho@...ho.pizza>
Cc: Christian Brauner <brauner@...nel.org>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
Tycho Andersen <tandersen@...flix.com>
Subject: Re: [RFC 1/3] pidfd: allow pidfd_open() on non-thread-group leaders
Hi Tycho,
I can't really read this patch now, possibly I am wrong, but...
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 ;)
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...
No?
Oleg.
Powered by blists - more mailing lists