aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2022-04-11 16:17:28 -0500
committerEric W. Biederman <ebiederm@xmission.com>2022-05-07 09:01:59 -0500
commit36cb0e1cda645ee645b85a6ce652cb46a16e14e5 (patch)
treef4c38b8a981df1a2f7fd4681c6cc4f6859893f0f /kernel/fork.c
parentc5febea0956fd3874e8fb59c6f84d68f128d68f8 (diff)
downloadlinux-36cb0e1cda645ee645b85a6ce652cb46a16e14e5.tar.gz
fork: Explicity test for idle tasks in copy_thread
The architectures ia64 and parisc have special handling for the idle thread in copy_process. Add a flag named idle to kernel_clone_args and use it to explicity test if an idle process is being created. Fullfill the expectations of the rest of the copy_thread implemetations and pass a function pointer in .stack from fork_idle(). This makes what is happening in copy_thread better defined, and is useful to make idle threads less special. Link: https://lkml.kernel.org/r/20220506141512.516114-3-ebiederm@xmission.com Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index d39a248a8d8db..93d77ee921ff5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2544,12 +2544,21 @@ static inline void init_idle_pids(struct task_struct *idle)
}
}
+static int idle_dummy(void *dummy)
+{
+ /* This function is never called */
+ return 0;
+}
+
struct task_struct * __init fork_idle(int cpu)
{
struct task_struct *task;
struct kernel_clone_args args = {
.flags = CLONE_VM,
+ .stack = (unsigned long)&idle_dummy,
+ .stack_size = (unsigned long)NULL,
.kthread = 1,
+ .idle = 1,
};
task = copy_process(&init_struct_pid, 0, cpu_to_node(cpu), &args);