Skip to content

Commit ff2a911

Browse files
author
Christian Brauner
committed
fork: remove do_fork()
Now that all architectures have been switched to use _do_fork() and the new struct kernel_clone_args calling convention we can remove the legacy do_fork() helper completely. The calling convention used to be brittle and do_fork() didn't buy us anything. The only calling convention accepted should be based on struct kernel_clone_args going forward. It's cleaner and uniform. Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Al Viro <[email protected]> Cc: "Matthew Wilcox (Oracle)" <[email protected]> Cc: "Peter Zijlstra (Intel)" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent adc7092 commit ff2a911

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

include/linux/sched/task.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ extern void exit_files(struct task_struct *);
9696
extern void exit_itimers(struct signal_struct *);
9797

9898
extern long _do_fork(struct kernel_clone_args *kargs);
99-
extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
10099
struct task_struct *fork_idle(int);
101100
struct mm_struct *copy_init_mm(void);
102101
extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);

kernel/fork.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,29 +2493,6 @@ long _do_fork(struct kernel_clone_args *args)
24932493
return nr;
24942494
}
24952495

2496-
#ifndef CONFIG_HAVE_COPY_THREAD_TLS
2497-
/* For compatibility with architectures that call do_fork directly rather than
2498-
* using the syscall entry points below. */
2499-
long do_fork(unsigned long clone_flags,
2500-
unsigned long stack_start,
2501-
unsigned long stack_size,
2502-
int __user *parent_tidptr,
2503-
int __user *child_tidptr)
2504-
{
2505-
struct kernel_clone_args args = {
2506-
.flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
2507-
.pidfd = parent_tidptr,
2508-
.child_tid = child_tidptr,
2509-
.parent_tid = parent_tidptr,
2510-
.exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
2511-
.stack = stack_start,
2512-
.stack_size = stack_size,
2513-
};
2514-
2515-
return _do_fork(&args);
2516-
}
2517-
#endif
2518-
25192496
/*
25202497
* Create a kernel thread.
25212498
*/
@@ -2923,7 +2900,7 @@ static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp
29232900
/*
29242901
* unshare allows a process to 'unshare' part of the process
29252902
* context which was originally shared using clone. copy_*
2926-
* functions used by do_fork() cannot be used here directly
2903+
* functions used by _do_fork() cannot be used here directly
29272904
* because they modify an inactive task_struct that is being
29282905
* constructed. Here we are modifying the current, active,
29292906
* task_struct.

0 commit comments

Comments
 (0)