sched: Add load based placement for RT tasks

Currently RT tasks prefer to go to the lowest power CPU in the
system. This can end up causing contention on the lowest power
CPU. Instead ensure that RT tasks end up on the lowest power
cluster and the least loaded CPU within that cluster.

Change-Id: I363b3d43236924962c67d2fb5d3d2d09800cd994
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
This commit is contained in:
Syed Rameez Mustafa 2015-07-21 15:00:59 -07:00 committed by David Keitel
parent 17bb9bcd54
commit d109fbbf71
2 changed files with 18 additions and 1 deletions

View file

@ -1656,6 +1656,7 @@ static int find_lowest_rq_hmp(struct task_struct *task)
{
struct cpumask *lowest_mask = *this_cpu_ptr(&local_cpu_mask);
int cpu_cost, min_cost = INT_MAX;
u64 cpu_load, min_load = ULLONG_MAX;
int best_cpu = -1;
int i;
@ -1689,11 +1690,26 @@ static int find_lowest_rq_hmp(struct task_struct *task)
if (sched_boost() && capacity(rq) != max_capacity)
continue;
if (cpu_cost < min_cost && !sched_cpu_high_irqload(i)) {
if (power_delta_exceeded(cpu_cost, min_cost)) {
if (cpu_cost > min_cost)
continue;
min_cost = cpu_cost;
min_load = ULLONG_MAX;
best_cpu = -1;
}
if (sched_cpu_high_irqload(i))
continue;
cpu_load = scale_load_to_cpu(
rq->hmp_stats.cumulative_runnable_avg, i);
if (cpu_load < min_load) {
min_load = cpu_load;
best_cpu = i;
}
}
return best_cpu;
}

View file

@ -1208,6 +1208,7 @@ extern void check_for_migration(struct rq *rq, struct task_struct *p);
extern void pre_big_small_task_count_change(const struct cpumask *cpus);
extern void post_big_small_task_count_change(const struct cpumask *cpus);
extern void set_hmp_defaults(void);
extern int power_delta_exceeded(unsigned int cpu_cost, unsigned int base_cost);
extern unsigned int power_cost_at_freq(int cpu, unsigned int freq);
extern void reset_all_window_stats(u64 window_start, unsigned int window_size);
extern void boost_kick(int cpu);