OSDN Git Service

sched: Take cluster's minimum power into account for optimizing sbc()
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / kernel / sched / fair.c
index 1cb4d18..fc31d1b 100644 (file)
@@ -3296,7 +3296,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;
 
@@ -3310,9 +3311,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),
@@ -3529,7 +3537,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;