Commit c9926cd1 authored by Yipeng Zou's avatar Yipeng Zou
Browse files

smart_grid: cpufreq: clear offline and isolated CPU in warm CPUs

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: 6a008918 ("smart_grid: cpufreq: introduce smart_grid cpufreq control")
Signed-off-by: default avatarYipeng Zou <zouyipeng@huawei.com>
Tested-by: default avatarjifa <jifa@huawei.com>
parent d4a9cbed
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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,9 +191,13 @@ 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],
	/* 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)