Skip to content

Commit 9ae15aa

Browse files
Peter Zijlstragregkh
authored andcommitted
x86/mm: Use mm_alloc() in poking_init()
commit 3f4c821 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) <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d972c8c commit 9ae15aa

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

arch/x86/mm/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ void __init poking_init(void)
827827
spinlock_t *ptl;
828828
pte_t *ptep;
829829

830-
poking_mm = copy_init_mm();
830+
poking_mm = mm_alloc();
831831
BUG_ON(!poking_mm);
832832

833833
/* Xen PV guests need the PGD to be pinned. */

include/linux/sched/task.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ extern void exit_itimers(struct task_struct *);
9090
extern pid_t kernel_clone(struct kernel_clone_args *kargs);
9191
struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node);
9292
struct task_struct *fork_idle(int);
93-
struct mm_struct *copy_init_mm(void);
9493
extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
9594
extern pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags);
9695
extern long kernel_wait4(pid_t, int __user *, int, struct rusage *);

kernel/fork.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,11 +2600,6 @@ struct task_struct * __init fork_idle(int cpu)
26002600
return task;
26012601
}
26022602

2603-
struct mm_struct *copy_init_mm(void)
2604-
{
2605-
return dup_mm(NULL, &init_mm);
2606-
}
2607-
26082603
/*
26092604
* This is like kernel_clone(), but shaved down and tailored to just
26102605
* creating io_uring workers. It returns a created task, or an error pointer.

0 commit comments

Comments
 (0)