[PATCH] sched: clarify ptrace's effect on task_struct->parent

From: Ziran Zhang

Date: Thu Sep 10 2026 - 00:27:12 EST


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@xxxxxxxx>
---
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