fork: Generalize PF_IO_WORKER handling
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 12 Apr 2022 15:18:48 +0000 (10:18 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Sat, 7 May 2022 14:01:59 +0000 (09:01 -0500)
commit5bd2e97c868a8a44470950ed01846cab6328e540
tree7919866d9e44b6c98bfe16f6ac436013ce9e75c0
parent36cb0e1cda645ee645b85a6ce652cb46a16e14e5
fork: Generalize PF_IO_WORKER handling

Add fn and fn_arg members into struct kernel_clone_args and test for
them in copy_thread (instead of testing for PF_KTHREAD | PF_IO_WORKER).
This allows any task that wants to be a user space task that only runs
in kernel mode to use this functionality.

The code on x86 is an exception and still retains a PF_KTHREAD test
because x86 unlikely everything else handles kthreads slightly
differently than user space tasks that start with a function.

The functions that created tasks that start with a function
have been updated to set ".fn" and ".fn_arg" instead of
".stack" and ".stack_size".  These functions are fork_idle(),
create_io_thread(), kernel_thread(), and user_mode_thread().

Link: https://lkml.kernel.org/r/20220506141512.516114-4-ebiederm@xmission.com
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
28 files changed:
arch/alpha/kernel/process.c
arch/arc/kernel/process.c
arch/arm/kernel/process.c
arch/arm64/kernel/process.c
arch/csky/kernel/process.c
arch/h8300/kernel/process.c
arch/hexagon/kernel/process.c
arch/ia64/kernel/process.c
arch/m68k/kernel/process.c
arch/microblaze/kernel/process.c
arch/mips/kernel/process.c
arch/nios2/kernel/process.c
arch/openrisc/kernel/process.c
arch/parisc/kernel/process.c
arch/powerpc/kernel/process.c
arch/riscv/kernel/process.c
arch/s390/kernel/process.c
arch/sh/kernel/process_32.c
arch/sparc/kernel/process_32.c
arch/sparc/kernel/process_64.c
arch/um/kernel/process.c
arch/x86/include/asm/fpu/sched.h
arch/x86/include/asm/switch_to.h
arch/x86/kernel/fpu/core.c
arch/x86/kernel/process.c
arch/xtensa/kernel/process.c
include/linux/sched/task.h
kernel/fork.c