diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-05-31 12:21:13 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-06-01 16:00:11 +0200 |
commit | 15faafc6b449777a85c0cf82dd8286c293fed4eb (patch) | |
tree | aaa65f485e131cc6f4d46219a05d9c5050b99189 /init | |
parent | sched: Add CONFIG_SCHED_CORE help text (diff) | |
download | linux-15faafc6b449777a85c0cf82dd8286c293fed4eb.tar.xz linux-15faafc6b449777a85c0cf82dd8286c293fed4eb.zip |
sched,init: Fix DEBUG_PREEMPT vs early boot
Extend 8fb12156b8db ("init: Pin init task to the boot CPU, initially")
to cover the new PF_NO_SETAFFINITY requirement.
While there, move wait_for_completion(&kthreadd_done) into kernel_init()
to make it absolutely clear it is the very first thing done by the init
thread.
Fixes: 570a752b7a9b ("lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Tested-by: Valentin Schneider <valentin.schneider@arm.com>
Tested-by: Borislav Petkov <bp@alien8.de>
Link: https://lkml.kernel.org/r/YLS4mbKUrA3Gnb4t@hirez.programming.kicks-ass.net
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/init/main.c b/init/main.c index 7b027d9c5c89..e945ec82b8a5 100644 --- a/init/main.c +++ b/init/main.c @@ -692,6 +692,7 @@ noinline void __ref rest_init(void) */ rcu_read_lock(); tsk = find_task_by_pid_ns(pid, &init_pid_ns); + tsk->flags |= PF_NO_SETAFFINITY; set_cpus_allowed_ptr(tsk, cpumask_of(smp_processor_id())); rcu_read_unlock(); @@ -1440,6 +1441,11 @@ static int __ref kernel_init(void *unused) { int ret; + /* + * Wait until kthreadd is all set-up. + */ + wait_for_completion(&kthreadd_done); + kernel_init_freeable(); /* need to finish all async __init code before freeing the memory */ async_synchronize_full(); @@ -1520,11 +1526,6 @@ void __init console_on_rootfs(void) static noinline void __init kernel_init_freeable(void) { - /* - * Wait until kthreadd is all set-up. - */ - wait_for_completion(&kthreadd_done); - /* Now the scheduler is fully set up and can do blocking allocations */ gfp_allowed_mask = __GFP_BITS_MASK; |