sched: Make the idle task quack like a per-CPU kthread
authorValentin Schneider <valentin.schneider@arm.com>
Mon, 10 May 2021 15:10:23 +0000 (16:10 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 18 May 2021 10:53:53 +0000 (12:53 +0200)
commit00b89fe0197f0c55a045775c11553c0cdb7082fe
tree242f776a1460b80467564ed1156eeacc212dac27
parentfcb501704554eebfd27e3220b0540997fd2b24a8
sched: Make the idle task quack like a per-CPU kthread

For all intents and purposes, the idle task is a per-CPU kthread. It isn't
created via the same route as other pcpu kthreads however, and as a result
it is missing a few bells and whistles: it fails kthread_is_per_cpu() and
it doesn't have PF_NO_SETAFFINITY set.

Fix the former by giving the idle task a kthread struct along with the
KTHREAD_IS_PER_CPU flag. This requires some extra iffery as init_idle()
call be called more than once on the same idle task.

Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210510151024.2448573-2-valentin.schneider@arm.com
include/linux/kthread.h
kernel/kthread.c
kernel/sched/core.c