]> git.baikalelectronics.ru Git - kernel.git/commit
sched: Fix Core-wide rq->lock for uninitialized CPUs
authorPeter Zijlstra <peterz@infradead.org>
Thu, 19 Aug 2021 11:09:17 +0000 (13:09 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 20 Aug 2021 10:32:53 +0000 (12:32 +0200)
commit33b766f043059bf93e3442a9732eff4fa8c1a097
tree581925bf416438a0e686d4dc21e4a965d8c5b348
parente1639f4e4b5ffc9b113b2453b7d0549f3b17007b
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: 611e7e8d79f6 ("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
kernel/sched/core.c
kernel/sched/sched.h