Skip to content

Commit 107b682

Browse files
author
Peter Zijlstra
committed
x86/mm: Use mm_alloc() in poking_init()
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]
1 parent a2e8795 commit 107b682

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
@@ -801,7 +801,7 @@ void __init poking_init(void)
801801
spinlock_t *ptl;
802802
pte_t *ptep;
803803

804-
poking_mm = copy_init_mm();
804+
poking_mm = mm_alloc();
805805
BUG_ON(!poking_mm);
806806

807807
/*

include/linux/sched/task.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ extern void exit_itimers(struct task_struct *);
9191
extern pid_t kernel_clone(struct kernel_clone_args *kargs);
9292
struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node);
9393
struct task_struct *fork_idle(int);
94-
struct mm_struct *copy_init_mm(void);
9594
extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
9695
extern pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags);
9796
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
@@ -2592,11 +2592,6 @@ struct task_struct * __init fork_idle(int cpu)
25922592
return task;
25932593
}
25942594

2595-
struct mm_struct *copy_init_mm(void)
2596-
{
2597-
return dup_mm(NULL, &init_mm);
2598-
}
2599-
26002595
/*
26012596
* This is like kernel_clone(), but shaved down and tailored to just
26022597
* creating io_uring workers. It returns a created task, or an error pointer.

0 commit comments

Comments
 (0)