diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2022-04-12 17:18:48 +0200 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2022-05-07 16:01:59 +0200 |
commit | 5bd2e97c868a8a44470950ed01846cab6328e540 (patch) | |
tree | 7919866d9e44b6c98bfe16f6ac436013ce9e75c0 /arch/ia64 | |
parent | fork: Explicity test for idle tasks in copy_thread (diff) | |
download | linux-5bd2e97c868a8a44470950ed01846cab6328e540.tar.xz linux-5bd2e97c868a8a44470950ed01846cab6328e540.zip |
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>
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/kernel/process.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 8f010ae818bc..167b1765bea1 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -341,14 +341,14 @@ copy_thread(struct task_struct *p, const struct kernel_clone_args *args) ia64_drop_fpu(p); /* don't pick up stale state from a CPU's fph */ - if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) { + if (unlikely(args->fn)) { if (unlikely(args->idle)) { /* fork_idle() called us */ return 0; } memset(child_stack, 0, sizeof(*child_ptregs) + sizeof(*child_stack)); - child_stack->r4 = user_stack_base; /* payload */ - child_stack->r5 = user_stack_size; /* argument */ + child_stack->r4 = (unsigned long) args->fn; + child_stack->r5 = (unsigned long) args->fn_arg; /* * Preserve PSR bits, except for bits 32-34 and 37-45, * which we can't read. |