Skip to contentSkip to conversation

kthread-update-comment-for-__to_kthread.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Jul 10, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kthread: update comment for __to_kthread
has been removed from the -mm tree. Its filename was
kthread-update-comment-for-__to_kthread.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Jiazi Li <[email protected]>
Subject: kthread: update comment for __to_kthread
Date: Fri, 20 Jun 2025 18:07:56 +0800

With commit 343f4c49f243 ("kthread: Don't allocate kthread_struct for init and umh") and commit 753550eb0ce1 ("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.

Suggested-by Eric W . Biederman <[email protected]>

---

 kernel/kthread.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
kernel/kthread.c renamed from kernel/kthread.c~kthread-update-comment-for-__to_kthread +5 -6
@@ -88,13 +88,12 @@ static inline struct kthread *to_kthread
 /*
  * Variant of to_kthread() that doesn't assume @p is a kthread.
  *
- * Per construction; when:
+ * When "(p->flags & PF_KTHREAD)" is set the task is a kthread and will
+ * always remain a kthread.  For kthreads p->worker_private always
+ * points to a struct kthread.  For tasks that are not kthreads
+ * p->worker_private is used to point to other things.
  *
- *   (p->flags & PF_KTHREAD) && p->worker_private
- *
- * the task is both a kthread and struct kthread is persistent. However
- * PF_KTHREAD on it's own is not, kernel_thread() can exec() (See umh.c and
- * begin_new_exec()).
+ * Return NULL for any task that is not a kthread.
  */
 static inline struct kthread *__to_kthread(struct task_struct *p)
 {

_

Patches currently in -mm which might be from [email protected] are