linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fork: clarify copy_mm() comment for kernel thread
@ 2026-01-27  5:53 Minu Jin
  2026-01-27  9:25 ` Lorenzo Stoakes
  0 siblings, 1 reply; 3+ messages in thread
From: Minu Jin @ 2026-01-27  5:53 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, akpm, david, kees
  Cc: dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
	lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
	linux-kernel, linux-mm, Minu Jin

The existing comment is misleading:

    1. "steal a active VM" suggests this code performs the active_mm
       borrowing, but the actual borrowing happens in context_switch()
       where 'next->active_mm = prev->active_mm' is assigned.
       This code simply returns 0 to skip mm copying for kernel threads.

    2. "active VM" is outdated terminology, the kernel uses "active_mm".

Update the comment to accurately describe what this code does.

Signed-off-by: Minu Jin <s9430939@naver.com>
---
 kernel/fork.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index b1f3915d5f8e..4bfd606004db 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1566,9 +1566,10 @@ static int copy_mm(u64 clone_flags, struct task_struct *tsk)
 	tsk->active_mm = NULL;
 
 	/*
-	 * Are we cloning a kernel thread?
+	 * Kernel threads have no 'mm' of their own as they borrow the
+	 * 'active_mm' from the previous process at context_switch().
 	 *
-	 * We need to steal a active VM for that..
+	 * Return 0 directly to skip the copy_mm process.
 	 */
 	oldmm = current->mm;
 	if (!oldmm)
-- 
2.43.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-27  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-27  5:53 [PATCH] fork: clarify copy_mm() comment for kernel thread Minu Jin
2026-01-27  9:25 ` Lorenzo Stoakes
2026-01-27  9:40   ` Minu Jin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox