From: Peter Zijlstra <peterz@infradead.org>
To: torvalds@linux-foundation.org, rostedt@goodmis.org,
dave.hansen@intel.com
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
x86@kernel.org, keescook@chromium.org, seanjc@google.com
Subject: [PATCH 2/5] x86/mm: Use mm_alloc() in poking_init()
Date: Tue, 25 Oct 2022 22:06:58 +0200 [thread overview]
Message-ID: <20221025201057.816175235@infradead.org> (raw)
In-Reply-To: <20221025200656.951281799@infradead.org>
Instead of duplicating init_mm, allocate a fresh mm. The advantage is
that mm_alloc() has much simpler dependencies. Additionally it makes
more conceptual sense, init_mm has no (and must not have) user state
to duplicate.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/mm/init.c | 2 +-
include/linux/sched/task.h | 1 -
kernel/fork.c | 5 -----
3 files changed, 1 insertion(+), 7 deletions(-)
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -801,7 +801,7 @@ void __init poking_init(void)
spinlock_t *ptl;
pte_t *ptep;
- poking_mm = copy_init_mm();
+ poking_mm = mm_alloc();
BUG_ON(!poking_mm);
/*
--- a/include/linux/sched/task.h
+++ b/include/linux/sched/task.h
@@ -91,7 +91,6 @@ extern void exit_itimers(struct task_str
extern pid_t kernel_clone(struct kernel_clone_args *kargs);
struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node);
struct task_struct *fork_idle(int);
-struct mm_struct *copy_init_mm(void);
extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
extern pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags);
extern long kernel_wait4(pid_t, int __user *, int, struct rusage *);
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2592,11 +2592,6 @@ struct task_struct * __init fork_idle(in
return task;
}
-struct mm_struct *copy_init_mm(void)
-{
- return dup_mm(NULL, &init_mm);
-}
-
/*
* This is like kernel_clone(), but shaved down and tailored to just
* creating io_uring workers. It returns a created task, or an error pointer.
next prev parent reply other threads:[~2022-10-25 20:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 20:06 [PATCH 0/5] x86/ftrace: Cure boot time W+X mapping Peter Zijlstra
2022-10-25 20:06 ` [PATCH 1/5] mm: Move mm_cachep initialization to mm_init() Peter Zijlstra
2022-11-02 9:12 ` [tip: x86/mm] " tip-bot2 for Peter Zijlstra
2022-12-17 18:55 ` tip-bot2 for Peter Zijlstra
2022-10-25 20:06 ` Peter Zijlstra [this message]
2022-11-02 9:12 ` [tip: x86/mm] x86/mm: Use mm_alloc() in poking_init() tip-bot2 for Peter Zijlstra
2022-12-17 18:55 ` tip-bot2 for Peter Zijlstra
2022-10-25 20:06 ` [PATCH 3/5] x86/mm: Initialize text poking earlier Peter Zijlstra
2022-11-02 9:12 ` [tip: x86/mm] " tip-bot2 for Peter Zijlstra
2022-12-17 18:55 ` tip-bot2 for Peter Zijlstra
2022-10-25 20:07 ` [PATCH 4/5] x86/ftrace: Remove SYSTEM_BOOTING exceptions Peter Zijlstra
2022-10-25 20:59 ` Steven Rostedt
2022-10-26 7:02 ` Peter Zijlstra
2022-11-02 9:12 ` [tip: x86/mm] " tip-bot2 for Peter Zijlstra
2022-12-17 18:55 ` tip-bot2 for Peter Zijlstra
2022-10-25 20:07 ` [PATCH 5/5] x86/mm: Do verify W^X at boot up Peter Zijlstra
2022-11-02 9:12 ` [tip: x86/mm] " tip-bot2 for Peter Zijlstra
2022-12-17 18:55 ` tip-bot2 for Peter Zijlstra
2022-10-25 23:07 ` [PATCH 0/5] x86/ftrace: Cure boot time W+X mapping Linus Torvalds
2022-10-25 23:17 ` Steven Rostedt
2022-10-26 7:15 ` Peter Zijlstra
2022-10-26 17:59 ` Linus Torvalds
2022-10-27 6:59 ` Peter Zijlstra
2022-10-29 11:30 ` Peter Zijlstra
2022-10-29 17:35 ` Linus Torvalds
2022-11-02 9:12 ` [tip: x86/mm] mm: Introduce set_memory_rox() tip-bot2 for Peter Zijlstra
2022-12-17 18:55 ` tip-bot2 for Peter Zijlstra
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=20221025201057.816175235@infradead.org \
--to=peterz@infradead.org \
--cc=dave.hansen@intel.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@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
all inboxes | Powered by JetHome®