* [PATCH 0/1] pidfd: don't do_notify_pidfd() if !thread_group_empty()
@ 2024-01-27 13:20 Oleg Nesterov
2024-01-27 13:21 ` [PATCH 1/1] " Oleg Nesterov
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Oleg Nesterov @ 2024-01-27 13:20 UTC (permalink / raw)
To: Christian Brauner
Cc: Eric W. Biederman, Tycho Andersen, Tycho Andersen, linux-kernel
To me this patch makes sense regardless, but also this is another
preparation for PIDFD_THREAD change we discuss.
Oleg.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] pidfd: don't do_notify_pidfd() if !thread_group_empty()
2024-01-27 13:20 [PATCH 0/1] pidfd: don't do_notify_pidfd() if !thread_group_empty() Oleg Nesterov
@ 2024-01-27 13:21 ` Oleg Nesterov
2024-01-27 17:22 ` Tycho Andersen
2024-01-27 13:24 ` Oleg Nesterov
2024-01-29 13:55 ` [PATCH 0/1] " Christian Brauner
2 siblings, 1 reply; 6+ messages in thread
From: Oleg Nesterov @ 2024-01-27 13:21 UTC (permalink / raw)
To: Christian Brauner
Cc: Eric W. Biederman, Tycho Andersen, Tycho Andersen, linux-kernel
do_notify_pidfd() makes no sense until the whole thread group exits, change
do_notify_parent() to check thread_group_empty().
This avoids the unnecessary do_notify_pidfd() when tsk is not a leader, or
it exits before other threads, or it has a ptraced EXIT_ZOMBIE sub-thread.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/signal.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index c9c57d053ce4..9561a3962ca6 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2050,9 +2050,11 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
WARN_ON_ONCE(!tsk->ptrace &&
(tsk->group_leader != tsk || !thread_group_empty(tsk)));
-
- /* Wake up all pidfd waiters */
- do_notify_pidfd(tsk);
+ /*
+ * tsk is a group leader and has no threads, wake up the pidfd waiters.
+ */
+ if (thread_group_empty(tsk))
+ do_notify_pidfd(tsk);
if (sig != SIGCHLD) {
/*
--
2.25.1.362.g51ebf55
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/1] pidfd: don't do_notify_pidfd() if !thread_group_empty()
2024-01-27 13:20 [PATCH 0/1] pidfd: don't do_notify_pidfd() if !thread_group_empty() Oleg Nesterov
2024-01-27 13:21 ` [PATCH 1/1] " Oleg Nesterov
@ 2024-01-27 13:24 ` Oleg Nesterov
2024-01-29 13:55 ` [PATCH 0/1] " Christian Brauner
2 siblings, 0 replies; 6+ messages in thread
From: Oleg Nesterov @ 2024-01-27 13:24 UTC (permalink / raw)
To: Christian Brauner
Cc: Eric W. Biederman, Tycho Andersen, Tycho Andersen, linux-kernel
do_notify_pidfd() makes no sense until the whole thread group exits, change
do_notify_parent() to check thread_group_empty().
This avoids the unnecessary do_notify_pidfd() when tsk is not a leader, or
it exits before other threads, or it has a ptraced EXIT_ZOMBIE sub-thread.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/signal.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index c9c57d053ce4..9561a3962ca6 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2050,9 +2050,11 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
WARN_ON_ONCE(!tsk->ptrace &&
(tsk->group_leader != tsk || !thread_group_empty(tsk)));
-
- /* Wake up all pidfd waiters */
- do_notify_pidfd(tsk);
+ /*
+ * tsk is a group leader and has no threads, wake up the pidfd waiters.
+ */
+ if (thread_group_empty(tsk))
+ do_notify_pidfd(tsk);
if (sig != SIGCHLD) {
/*
--
2.25.1.362.g51ebf55
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] pidfd: don't do_notify_pidfd() if !thread_group_empty()
2024-01-27 13:21 ` [PATCH 1/1] " Oleg Nesterov
@ 2024-01-27 17:22 ` Tycho Andersen
2024-01-27 19:32 ` Oleg Nesterov
0 siblings, 1 reply; 6+ messages in thread
From: Tycho Andersen @ 2024-01-27 17:22 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Christian Brauner, Eric W. Biederman, Tycho Andersen,
linux-kernel
On Sat, Jan 27, 2024 at 02:21:05PM +0100, Oleg Nesterov wrote:
> do_notify_pidfd() makes no sense until the whole thread group exits, change
> do_notify_parent() to check thread_group_empty().
>
> This avoids the unnecessary do_notify_pidfd() when tsk is not a leader, or
> it exits before other threads, or it has a ptraced EXIT_ZOMBIE sub-thread.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Looks good to me, thanks.
Reviewed-by: Tycho Andersen <tandersen@netflix.com>
Tycho
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] pidfd: don't do_notify_pidfd() if !thread_group_empty()
2024-01-27 17:22 ` Tycho Andersen
@ 2024-01-27 19:32 ` Oleg Nesterov
0 siblings, 0 replies; 6+ messages in thread
From: Oleg Nesterov @ 2024-01-27 19:32 UTC (permalink / raw)
To: Tycho Andersen
Cc: Christian Brauner, Eric W. Biederman, Tycho Andersen,
linux-kernel
On 01/27, Tycho Andersen wrote:
>
> On Sat, Jan 27, 2024 at 02:21:05PM +0100, Oleg Nesterov wrote:
> > do_notify_pidfd() makes no sense until the whole thread group exits, change
> > do_notify_parent() to check thread_group_empty().
> >
> > This avoids the unnecessary do_notify_pidfd() when tsk is not a leader, or
> > it exits before other threads, or it has a ptraced EXIT_ZOMBIE sub-thread.
> >
> > Signed-off-by: Oleg Nesterov <oleg@redhat.com>
>
> Looks good to me, thanks.
>
> Reviewed-by: Tycho Andersen <tandersen@netflix.com>
Thanks Tycho,
Oleg.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/1] pidfd: don't do_notify_pidfd() if !thread_group_empty()
2024-01-27 13:20 [PATCH 0/1] pidfd: don't do_notify_pidfd() if !thread_group_empty() Oleg Nesterov
2024-01-27 13:21 ` [PATCH 1/1] " Oleg Nesterov
2024-01-27 13:24 ` Oleg Nesterov
@ 2024-01-29 13:55 ` Christian Brauner
2 siblings, 0 replies; 6+ messages in thread
From: Christian Brauner @ 2024-01-29 13:55 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Christian Brauner, Eric W. Biederman, Tycho Andersen,
Tycho Andersen, linux-kernel
On Sat, 27 Jan 2024 14:20:43 +0100, Oleg Nesterov wrote:
> To me this patch makes sense regardless, but also this is another
> preparation for PIDFD_THREAD change we discuss.
>
> Oleg.
>
Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc
[1/1] pidfd: don't do_notify_pidfd() if !thread_group_empty()
https://git.kernel.org/vfs/vfs/c/e191619dcdca
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-29 13:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-27 13:20 [PATCH 0/1] pidfd: don't do_notify_pidfd() if !thread_group_empty() Oleg Nesterov
2024-01-27 13:21 ` [PATCH 1/1] " Oleg Nesterov
2024-01-27 17:22 ` Tycho Andersen
2024-01-27 19:32 ` Oleg Nesterov
2024-01-27 13:24 ` Oleg Nesterov
2024-01-29 13:55 ` [PATCH 0/1] " Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox