Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 833279ca authored by Satya Durga Srinivasu Prabhala's avatar Satya Durga Srinivasu Prabhala
Browse files

sched/core_ctl: Pass sorted clusters based on capacity to cluster_init



Core control assumes that the clusters in the system are sorted
based on their capacity, i.e., first cluster is the minimum
capacity cluster and last cluster is the max capacity cluster,
but, there are systems which has max capacity cluster as first
cluster of the system and min capacity cluster as last cluster
in the system. This assumption breaks core control for systems
with max capacity system as first cluster. To make sure core
control won't be broken for such systems, pass sorted clusters
based on the capacity to cluster_init.

Change-Id: Ib27698080b9e4fe8b0e7789b9042d0a210fda486
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent 57116e14
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -1233,8 +1233,8 @@ static int cluster_init(const struct cpumask *mask)

static int __init core_ctl_init(void)
{
	unsigned int cpu;
	struct cpumask cpus = *cpu_possible_mask;
	struct sched_cluster *cluster;
	int ret;

	cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
			"core_ctl/isolation:online",
@@ -1244,15 +1244,12 @@ static int __init core_ctl_init(void)
			"core_ctl/isolation:dead",
			NULL, core_ctl_isolation_dead_cpu);

	for_each_cpu(cpu, &cpus) {
		int ret;
		const struct cpumask *cluster_cpus = cpu_coregroup_mask(cpu);

		ret = cluster_init(cluster_cpus);
	for_each_sched_cluster(cluster) {
		ret = cluster_init(&cluster->cpus);
		if (ret)
			pr_warn("unable to create core ctl group: %d\n", ret);
		cpumask_andnot(&cpus, &cpus, cluster_cpus);
	}

	initialized = true;
	return 0;
}