hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8MFO6 CVE: NA
----------------------------------------
When there has some CPU has been offline or isolated, the warm zone CPUs will not clear these CPUs.
Because of the warm zone were saluted by a complement of hot zone.
So, we need to clear offline and isolated CPUs in every time's warm zone CPUs update.
Fixes: 6a00891859d8 ("smart_grid: cpufreq: introduce smart_grid cpufreq control") Signed-off-by: Yipeng Zou zouyipeng@huawei.com --- kernel/sched/grid/qos.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/grid/qos.c b/kernel/sched/grid/qos.c index f8c5deffd3ea..7ee3687347ce 100644 --- a/kernel/sched/grid/qos.c +++ b/kernel/sched/grid/qos.c @@ -179,6 +179,7 @@ int sched_grid_zone_update(bool is_locked) raw_spin_lock_irqsave(&sg_zone.lock, flags);
cpumask_clear(&sg_zone.cpus[SMART_GRID_ZONE_HOT]); + cpumask_clear(&sg_zone.cpus[SMART_GRID_ZONE_WARM]);
list_for_each(pos, &sg_zone.af_list_head) { af_pos = list_entry(pos, struct auto_affinity, af_list); @@ -190,10 +191,14 @@ int sched_grid_zone_update(bool is_locked)
cpumask_or(&sg_zone.cpus[SMART_GRID_ZONE_HOT], &sg_zone.cpus[SMART_GRID_ZONE_HOT], af_pos->ad.domains[af_pos->ad.curr_level]); + /* Update warm zone CPUs to max level first */ + cpumask_or(&sg_zone.cpus[SMART_GRID_ZONE_WARM], &sg_zone.cpus[SMART_GRID_ZONE_WARM], + af_pos->ad.domains[af_pos->ad.dcount - 1]); }
- cpumask_complement(&sg_zone.cpus[SMART_GRID_ZONE_WARM], - &sg_zone.cpus[SMART_GRID_ZONE_HOT]); + /* Then reset warm zone CPUs without hot zone CPUs */ + cpumask_andnot(&sg_zone.cpus[SMART_GRID_ZONE_WARM], &sg_zone.cpus[SMART_GRID_ZONE_WARM], + &sg_zone.cpus[SMART_GRID_ZONE_HOT]);
if (!is_locked) raw_spin_unlock_irqrestore(&sg_zone.lock, flags);