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

Commit af1db6e0 authored by Joonwoo Park's avatar Joonwoo Park
Browse files

sched: fix excessive task packing where CONFIG_SCHED_HMP_CSTATE_AWARE=y



At present among the same power cost and c-state CPUs scheduler places
newly waking up task on the most loaded CPU which can incur too much of
task packing on the same CPU.  Place onto the most loaded CPU only when
the best CPU is in idle cstate, otherwise spread out by placing onto the
least loaded CPU.

CRs-fixed: 1006303
Change-Id: I8ae7332971b3293d912b1582f75e33fd81407d86
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
parent 3cd03903
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -2915,7 +2915,7 @@ struct cluster_cpu_stats {
	int best_capacity_cpu, best_cpu, best_sibling_cpu;
	int min_cost, best_sibling_cpu_cost;
	int best_cpu_cstate;
	u64 min_load, max_load, best_sibling_cpu_load;
	u64 min_load, best_load, best_sibling_cpu_load;
	s64 highest_spare_capacity;
};

@@ -3181,7 +3181,7 @@ static void __update_cluster_stats(int cpu, struct cluster_cpu_stats *stats,
	if (cpu_cost < stats->min_cost)  {
		stats->min_cost = cpu_cost;
		stats->best_cpu_cstate = cpu_cstate;
		stats->max_load = env->cpu_load;
		stats->best_load = env->cpu_load;
		stats->best_cpu = cpu;
		return;
	}
@@ -3193,7 +3193,7 @@ static void __update_cluster_stats(int cpu, struct cluster_cpu_stats *stats,

	if (cpu_cstate < stats->best_cpu_cstate) {
		stats->best_cpu_cstate = cpu_cstate;
		stats->max_load = env->cpu_load;
		stats->best_load = env->cpu_load;
		stats->best_cpu = cpu;
		return;
	}
@@ -3204,8 +3204,10 @@ static void __update_cluster_stats(int cpu, struct cluster_cpu_stats *stats,
		return;
	}

	if (stats->best_cpu != prev_cpu && env->cpu_load > stats->max_load) {
		stats->max_load = env->cpu_load;
	if (stats->best_cpu != prev_cpu &&
	    ((cpu_cstate == 0 && env->cpu_load < stats->best_load) ||
	    (cpu_cstate > 0 && env->cpu_load > stats->best_load))) {
		stats->best_load = env->cpu_load;
		stats->best_cpu = cpu;
	}
}
@@ -3292,10 +3294,10 @@ static inline void init_cluster_cpu_stats(struct cluster_cpu_stats *stats)
	stats->best_capacity_cpu = stats->best_sibling_cpu  = -1;
	stats->min_cost = stats->best_sibling_cpu_cost = INT_MAX;
	stats->min_load	= stats->best_sibling_cpu_load = ULLONG_MAX;
	stats->max_load = 0;
	stats->highest_spare_capacity = 0;
	stats->least_loaded_cpu = -1;
	stats->best_cpu_cstate = INT_MAX;
	/* No need to initialize stats->best_load */
}

/*