]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched: Initialize idle tasks only once
authorThomas Gleixner <tglx@linutronix.de>
Mon, 28 Oct 2024 10:43:42 +0000 (11:43 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 5 Nov 2024 11:55:37 +0000 (12:55 +0100)
commitb23decf8ac9102fc52c4de5196f4dc0a5f3eb80b
treec8a60780b61c8c185a8e3a0e74257bcc13aa799a
parent1a6151017ee5a30cb2d959f110ab18fc49646467
sched: Initialize idle tasks only once

Idle tasks are initialized via __sched_fork() twice:

     fork_idle()
        copy_process()
  sched_fork()
             __sched_fork()
init_idle()
          __sched_fork()

Instead of cleaning this up, sched_ext hacked around it. Even when analyis
and solution were provided in a discussion, nobody cared to clean this up.

init_idle() is also invoked from sched_init() to initialize the boot CPU's
idle task, which requires the __sched_fork() invocation. But this can be
trivially solved by invoking __sched_fork() before init_idle() in
sched_init() and removing the __sched_fork() invocation from init_idle().

Do so and clean up the comments explaining this historical leftover.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241028103142.359584747@linutronix.de
kernel/sched/core.c