summaryrefslogtreecommitdiffstats
path: root/kernel/sched/sched.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2021-08-19 13:09:17 +0200
committerPeter Zijlstra <peterz@infradead.org>2021-08-20 12:32:53 +0200
commit3c474b3239f12fe0b00d7e82481f36a1f31e79ab (patch)
tree581925bf416438a0e686d4dc21e4a965d8c5b348 /kernel/sched/sched.h
parent7c60610d476766e128cc4284bb6349732cbd6606 (diff)
downloadlinux-stable-3c474b3239f12fe0b00d7e82481f36a1f31e79ab.tar.gz
linux-stable-3c474b3239f12fe0b00d7e82481f36a1f31e79ab.tar.bz2
linux-stable-3c474b3239f12fe0b00d7e82481f36a1f31e79ab.zip
sched: Fix Core-wide rq->lock for uninitialized CPUs
Eugene tripped over the case where rq_lock(), as called in a for_each_possible_cpu() loop came apart because rq->core hadn't been setup yet. This is a somewhat unusual, but valid case. Rework things such that rq->core is initialized to point at itself. IOW initialize each CPU as a single threaded Core. CPU online will then join the new CPU (thread) to an existing Core where needed. For completeness sake, have CPU offline fully undo the state so as to not presume the topology will match the next time it comes online. Fixes: 9edeaea1bc45 ("sched: Core-wide rq->lock") Reported-by: Eugene Syromiatnikov <esyr@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Josh Don <joshdon@google.com> Tested-by: Eugene Syromiatnikov <esyr@redhat.com> Link: https://lkml.kernel.org/r/YR473ZGeKqMs6kw+@hirez.programming.kicks-ass.net
Diffstat (limited to 'kernel/sched/sched.h')
-rw-r--r--kernel/sched/sched.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 14a41a243f7b..da4295f5ab77 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1093,7 +1093,7 @@ struct rq {
unsigned int core_sched_seq;
struct rb_root core_tree;
- /* shared state */
+ /* shared state -- careful with sched_core_cpu_deactivate() */
unsigned int core_task_seq;
unsigned int core_pick_seq;
unsigned long core_cookie;