Skip to content

Commit fed307b

Browse files
Jiazi Liakpm00
authored andcommitted
kthread: update comment for __to_kthread
With commit 343f4c4 ("kthread: Don't allocate kthread_struct for init and umh") and commit 753550e ("fork: Explicitly set PF_KTHREAD"), umh task no longer have struct kthread and PF_KTHREAD flag. Update the comment to describe what the current rules are to detect is something is a kthread. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Jiazi Li <[email protected]> Signed-off-by: mingzhu.wang <[email protected]> Suggested-by Eric W . Biederman <[email protected]> Reviewed-by: "Eric W. Biederman" <[email protected]> Cc: Peter Zijlstra <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent caf728d commit fed307b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

kernel/kthread.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,12 @@ static inline struct kthread *to_kthread(struct task_struct *k)
8888
/*
8989
* Variant of to_kthread() that doesn't assume @p is a kthread.
9090
*
91-
* Per construction; when:
91+
* When "(p->flags & PF_KTHREAD)" is set the task is a kthread and will
92+
* always remain a kthread. For kthreads p->worker_private always
93+
* points to a struct kthread. For tasks that are not kthreads
94+
* p->worker_private is used to point to other things.
9295
*
93-
* (p->flags & PF_KTHREAD) && p->worker_private
94-
*
95-
* the task is both a kthread and struct kthread is persistent. However
96-
* PF_KTHREAD on it's own is not, kernel_thread() can exec() (See umh.c and
97-
* begin_new_exec()).
96+
* Return NULL for any task that is not a kthread.
9897
*/
9998
static inline struct kthread *__to_kthread(struct task_struct *p)
10099
{

0 commit comments

Comments
 (0)