public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "zhijun.han" <hanzj.it@gmail.com>
To: brauner@kernel.org, linux-kernel@vger.kernel.org
Cc: hanzj.it@gmail.com
Subject: [PATCH] fork: Using oldmm replace current->mm for dup_mm
Date: Tue, 30 Jul 2024 16:27:25 +0800	[thread overview]
Message-ID: <20240730082725.7477-1-hanzj.it@gmail.com> (raw)

In the current implementation of copy_mm(),there is a line
initializes `oldmm = current->mm` before dup_mm.
This means that there is no longer a need to use current->mm for
dup_mm.

Signed-off-by: zhijun.han <hanzj.it@gmail.com>
---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 41771bde2ce7..833557bb0187 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1720,7 +1720,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
 		mmget(oldmm);
 		mm = oldmm;
 	} else {
-		mm = dup_mm(tsk, current->mm);
+		mm = dup_mm(tsk, oldmm);
 		if (!mm)
 			return -ENOMEM;
 	}
-- 
2.45.2


                 reply	other threads:[~2024-07-30  8:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240730082725.7477-1-hanzj.it@gmail.com \
    --to=hanzj.it@gmail.com \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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