* [PATCH] sched: clarify ptrace's effect on task_struct->parent
@ 2026-09-10 4:17 Ziran Zhang
2026-09-10 12:54 ` Oleg Nesterov
2026-09-10 13:30 ` [PATCH v2] " Ziran Zhang
0 siblings, 2 replies; 4+ messages in thread
From: Ziran Zhang @ 2026-09-10 4:17 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
Cc: Oleg Nesterov, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, K Prateek Nayak, linux-kernel,
Ziran Zhang
The current comment for the parent field does not explain that it can be
temporarily replaced by the tracer when the task is being ptraced.
This can lead to confusion, so clarify the comment to document this
important behavior.
No functional change.
Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
---
include/linux/sched.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 705970d07..977859a63 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1093,7 +1093,11 @@ struct task_struct {
/* Real parent process: */
struct task_struct __rcu *real_parent;
- /* Recipient of SIGCHLD, wait4() reports: */
+ /*
+ * Recipient of SIGCHLD, wait4() reports. Normally the same as
+ * real_parent, but temporarily replaced by the tracer while the
+ * task is ptraced.
+ */
struct task_struct __rcu *parent;
/*
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sched: clarify ptrace's effect on task_struct->parent
2026-09-10 4:17 [PATCH] sched: clarify ptrace's effect on task_struct->parent Ziran Zhang
@ 2026-09-10 12:54 ` Oleg Nesterov
2026-09-10 13:16 ` Ziran Zhang
2026-09-10 13:30 ` [PATCH v2] " Ziran Zhang
1 sibling, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2026-09-10 12:54 UTC (permalink / raw)
To: Ziran Zhang
Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak, linux-kernel
On 09/10, Ziran Zhang wrote:
> The current comment for the parent field does not explain that it can be
> temporarily replaced by the tracer when the task is being ptraced.
>
> This can lead to confusion, so clarify the comment to document this
> important behavior.
>
> No functional change.
>
> Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
> ---
> include/linux/sched.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 705970d07..977859a63 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1093,7 +1093,11 @@ struct task_struct {
> /* Real parent process: */
> struct task_struct __rcu *real_parent;
>
> - /* Recipient of SIGCHLD, wait4() reports: */
> + /*
> + * Recipient of SIGCHLD, wait4() reports. Normally the same as
> + * real_parent, but temporarily replaced by the tracer while the
> + * task is ptraced.
> + */
> struct task_struct __rcu *parent;
Well. Not sure this comment needs to be updated...
Anyway, this looks like overdocumentation to me. Perhaps just
/* Recipient of SIGCHLD, wait4() reports: ->real_parent or ptracer */
?
Oleg.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sched: clarify ptrace's effect on task_struct->parent
2026-09-10 12:54 ` Oleg Nesterov
@ 2026-09-10 13:16 ` Ziran Zhang
0 siblings, 0 replies; 4+ messages in thread
From: Ziran Zhang @ 2026-09-10 13:16 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak, linux-kernel, Ziran Zhang
On Thu, 10 Sep 2026 14:54:04 +0200, Oleg Nesterov <oleg@redhat.com> wrote:
> Well. Not sure this comment needs to be updated...
>
> Anyway, this looks like overdocumentation to me. Perhaps just
>
> /* Recipient of SIGCHLD, wait4() reports: ->real_parent or ptracer */
>
> ?
>
> Oleg.
Agreed, the long form is overdocumenting it. I'll send a v2 patch with your
suggestion.
Best,
Ziran Zhang
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] sched: clarify ptrace's effect on task_struct->parent
2026-09-10 4:17 [PATCH] sched: clarify ptrace's effect on task_struct->parent Ziran Zhang
2026-09-10 12:54 ` Oleg Nesterov
@ 2026-09-10 13:30 ` Ziran Zhang
1 sibling, 0 replies; 4+ messages in thread
From: Ziran Zhang @ 2026-09-10 13:30 UTC (permalink / raw)
To: Oleg Nesterov, Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak, linux-kernel, Ziran Zhang
The current comment for the parent field does not explain that it can be
temporarily replaced by the tracer when the task is being ptraced.
This can lead to confusion, so clarify the comment to document this
important behavior.
No functional change.
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
---
Changes in v2:
- Use Oleg's minimal wording suggestion to adjust comment.
include/linux/sched.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 705970d07..8aad8a8ef 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1093,7 +1093,7 @@ struct task_struct {
/* Real parent process: */
struct task_struct __rcu *real_parent;
- /* Recipient of SIGCHLD, wait4() reports: */
+ /* Recipient of SIGCHLD, wait4() reports: ->real_parent or ptracer */
struct task_struct __rcu *parent;
/*
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-10 13:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 4:17 [PATCH] sched: clarify ptrace's effect on task_struct->parent Ziran Zhang
2026-09-10 12:54 ` Oleg Nesterov
2026-09-10 13:16 ` Ziran Zhang
2026-09-10 13:30 ` [PATCH v2] " Ziran Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®