From: Peter Zijlstra Date: Tue, 25 Oct 2022 19:38:21 +0000 (+0200) Subject: x86/mm: Use mm_alloc() in poking_init() X-Git-Tag: v6.1.52~661 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ae15aaff39c831e2f9d8b029e85a2d70c7c8a68;p=platform%2Fkernel%2Flinux-starfive.git x86/mm: Use mm_alloc() in poking_init() commit 3f4c8211d982099be693be9aa7d6fc4607dff290 upstream. 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) Link: https://lkml.kernel.org/r/20221025201057.816175235@infradead.org Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index d0563830..913287b 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -827,7 +827,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); /* Xen PV guests need the PGD to be pinned. */ diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index d6c4816..f0441ef 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -90,7 +90,6 @@ extern void exit_itimers(struct task_struct *); 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 *); diff --git a/kernel/fork.c b/kernel/fork.c index 6bb91fb..ab4def8 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2600,11 +2600,6 @@ struct task_struct * __init fork_idle(int cpu) 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.