hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8TBJJ CVE: NA
--------------------------------
The cpufreq policy may be shared between hot and warm zone.
In the case for this, we have two sd_level which all belongs to one cpufreq policy.
1. sd_level 0, cpu list 124-127 2. sd_level 1, cpu list 96-127
So in the old code, 96-127 policy will be set to warm zone governor.
But it should be hot zone governor, because We need to make sure hot zone have the highest priority.
Fixes: 6a00891859d8 ("smart_grid: cpufreq: introduce smart_grid cpufreq control") Signed-off-by: Yipeng Zou zouyipeng@huawei.com --- drivers/cpufreq/cpufreq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 574c9584923f..62b6ca5e7356 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2821,7 +2821,11 @@ static void smart_grid_work_handler(struct work_struct *work) return; }
- for (gov_index = 0; gov_index < SMART_GRID_ZONE_NR; gov_index++) { + /* + * Because of the policy may be shared between hot and warm zone. + * We need to make sure hot zone have the highest priority. + */ + for (gov_index = SMART_GRID_ZONE_NR - 1; gov_index >= 0; gov_index--) { target_gov = cpufreq_parse_governor(sg_zone.governor_name[gov_index]); if (target_gov == NULL) continue;