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

Commit 060d79c2 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched: Take cluster's minimum power into account for optimizing sbc()



The select_best_cpu() algorithm iterates over all the clusters and
selects the most power efficient CPU that satisfies the task needs.
During the search, skip the next cluster if its minimum power cost
is higher than the power cost of an eligible CPU found in the previous
cluster.

In a b.L system, if the BIG cluster minimum power cost is higher than
the maximum power cost of the little cluster, this optimization avoids
searching the BIG cluster if an eligible CPU is found in the little
cluster.

Change-Id: I5e3755f107edb6c72180edbec2a658be931c276d
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent ef2e6027
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1301,6 +1301,7 @@ static struct sched_cluster init_cluster = {
	.list			=	LIST_HEAD_INIT(init_cluster.list),
	.id			=	0,
	.max_power_cost		=	1,
	.min_power_cost		=	1,
	.capacity		=	1024,
	.max_possible_capacity	=	1024,
	.efficiency		=	1,
@@ -1401,9 +1402,12 @@ static void sort_clusters(void)

	INIT_LIST_HEAD(&new_head);

	for_each_sched_cluster(cluster)
	for_each_sched_cluster(cluster) {
		cluster->max_power_cost = power_cost(cluster_first_cpu(cluster),
							       max_task_load());
		cluster->min_power_cost = power_cost(cluster_first_cpu(cluster),
							       0);
	}

	move_list(&new_head, &cluster_head, true);

@@ -1445,6 +1449,7 @@ static struct sched_cluster *alloc_new_cluster(const struct cpumask *cpus)

	INIT_LIST_HEAD(&cluster->list);
	cluster->max_power_cost		=	1;
	cluster->min_power_cost		=	1;
	cluster->capacity		=	1024;
	cluster->max_possible_capacity	=	1024;
	cluster->efficiency		=	1;
+11 −3
Original line number Diff line number Diff line
@@ -3063,7 +3063,8 @@ struct cpu_select_env *env, struct cluster_cpu_stats *stats)
}

struct sched_cluster *
next_best_cluster(struct sched_cluster *cluster, struct cpu_select_env *env)
next_best_cluster(struct sched_cluster *cluster, struct cpu_select_env *env,
					struct cluster_cpu_stats *stats)
{
	struct sched_cluster *next = NULL;

@@ -3077,9 +3078,16 @@ next_best_cluster(struct sched_cluster *cluster, struct cpu_select_env *env)
			return NULL;

		next = next_candidate(env->candidate_list, 0, num_clusters);
		if (next)
		if (next) {
			if (next->min_power_cost > stats->min_cost) {
				clear_bit(next->id, env->candidate_list);
				next = NULL;
				continue;
			}

			if (skip_cluster(next, env))
				next = NULL;
		}
	} while (!next);

	env->task_load = scale_load_to_cpu(task_load(env->p),
@@ -3296,7 +3304,7 @@ retry:
	do {
		find_best_cpu_in_cluster(cluster, &env, &stats);

	} while ((cluster = next_best_cluster(cluster, &env)));
	} while ((cluster = next_best_cluster(cluster, &env, &stats)));

	if (stats.best_idle_cpu >= 0) {
		target = stats.best_idle_cpu;
+1 −0
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@ struct sched_cluster {
	struct cpumask cpus;
	int id;
	int max_power_cost;
	int min_power_cost;
	int max_possible_capacity;
	int capacity;
	int efficiency; /* Differentiate cpus with different IPC capability */