public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fork: Using oldmm replace current->mm for dup_mm
@ 2024-07-30  8:27 zhijun.han
  0 siblings, 0 replies; only message in thread
From: zhijun.han @ 2024-07-30  8:27 UTC (permalink / raw)
  To: brauner, linux-kernel; +Cc: hanzj.it

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-30  8:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30  8:27 [PATCH] fork: Using oldmm replace current->mm for dup_mm zhijun.han

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