linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minu Jin <s9430939@naver.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, akpm@linux-foundation.org,
	david@kernel.org, kees@kernel.org
Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
	vbabka@suse.cz, rppt@kernel.org, surenb@google.com,
	mhocko@suse.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, Minu Jin <s9430939@naver.com>
Subject: [PATCH] fork: clarify copy_mm() comment for kernel thread
Date: Tue, 27 Jan 2026 14:53:21 +0900	[thread overview]
Message-ID: <20260127055321.2400480-1-s9430939@naver.com> (raw)

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



             reply	other threads:[~2026-01-27  5:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27  5:53 Minu Jin [this message]
2026-01-27  9:25 ` Lorenzo Stoakes
2026-01-27  9:40   ` Minu Jin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260127055321.2400480-1-s9430939@naver.com \
    --to=s9430939@naver.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bsegall@google.com \
    --cc=david@kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox