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 --- drivers/cpufreq/cpufreq.c | 7 ++++++- kernel/sched/grid/qos.c | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 574c9584923f..a262eab3e771 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -29,6 +29,9 @@ #include <linux/syscore_ops.h> #include <linux/tick.h> #include <trace/events/power.h> +#ifdef CONFIG_QOS_SCHED_SMART_GRID +#include <linux/sched/isolation.h> +#endif
static LIST_HEAD(cpufreq_policy_list);
@@ -2827,7 +2830,9 @@ static void smart_grid_work_handler(struct work_struct *work) continue;
for_each_cpu(cpu, sched_grid_zone_cpumask(gov_index)) { - if (cpu_is_offline(cpu)) + /* bypass offline and isolated CPU */ + if (housekeeping_test_cpu(cpu, HK_FLAG_DOMAIN) || + cpu_is_offline(cpu)) continue;
policy = cpufreq_cpu_acquire(cpu); 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);
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3312 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/3...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3312 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/3...