sched/core: explicitly initialize coresched state
PATCH 1/1 sched/core: explicitly initialize coresched state
Some coresched state may be left as non-zero when we flip off coresched (ie. core_cookie, core_forceidle_count, etc.). This won't cause any issues when we flip coresched back on, but it is better to be more explicit about resetting this state.
Signed-off-by Josh Don <[email protected]>
--- kernel/sched/core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
kernel/sched/core.c +13 -3
@@ -282,13 +282,23 @@ static void __sched_core_flip(bool enabled)cpumask_copy (&sched_core_mask, cpu_online_mask);for_each_cpu (cpu, &sched_core_mask) {const struct cpumask *smt_mask =cpu_smt_mask (cpu); +struct rq *rq;sched_core_lock (cpu, &flags); -for_each_cpu (t, smt_mask) -cpu_rq (t)->core_enabled = enabled; +for_each_cpu (t, smt_mask) { + rq =cpu_rq (t); + + rq->core_pick =NULL ; + rq->core_enabled = enabled; + + } -cpu_rq (cpu)->core->core_forceidle_start =0 ; + rq =cpu_rq (cpu)->core; + rq->core_cookie =0 ; + rq->core_forceidle_count =0 ; + rq->core_forceidle_occupation =0 ; + rq->core_forceidle_start =0 ;sched_core_unlock (cpu, &flags);
Signature · 1 line
2.34.0.rc0.344.g81b53c2807-goog