diff options
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r-- | kernel/sched/fair.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 47a0c552c77b..396bca9c7996 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -5794,27 +5794,38 @@ static inline int select_idle_smt(struct task_struct *p, struct sched_domain *sd | |||
5794 | static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int target) | 5794 | static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int target) |
5795 | { | 5795 | { |
5796 | struct sched_domain *this_sd; | 5796 | struct sched_domain *this_sd; |
5797 | u64 avg_cost, avg_idle = this_rq()->avg_idle; | 5797 | u64 avg_cost, avg_idle; |
5798 | u64 time, cost; | 5798 | u64 time, cost; |
5799 | s64 delta; | 5799 | s64 delta; |
5800 | int cpu; | 5800 | int cpu, nr = INT_MAX; |
5801 | 5801 | ||
5802 | this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc)); | 5802 | this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc)); |
5803 | if (!this_sd) | 5803 | if (!this_sd) |
5804 | return -1; | 5804 | return -1; |
5805 | 5805 | ||
5806 | avg_cost = this_sd->avg_scan_cost; | ||
5807 | |||
5808 | /* | 5806 | /* |
5809 | * Due to large variance we need a large fuzz factor; hackbench in | 5807 | * Due to large variance we need a large fuzz factor; hackbench in |
5810 | * particularly is sensitive here. | 5808 | * particularly is sensitive here. |
5811 | */ | 5809 | */ |
5812 | if (sched_feat(SIS_AVG_CPU) && (avg_idle / 512) < avg_cost) | 5810 | avg_idle = this_rq()->avg_idle / 512; |
5811 | avg_cost = this_sd->avg_scan_cost + 1; | ||
5812 | |||
5813 | if (sched_feat(SIS_AVG_CPU) && avg_idle < avg_cost) | ||
5813 | return -1; | 5814 | return -1; |
5814 | 5815 | ||
5816 | if (sched_feat(SIS_PROP)) { | ||
5817 | u64 span_avg = sd->span_weight * avg_idle; | ||
5818 | if (span_avg > 4*avg_cost) | ||
5819 | nr = div_u64(span_avg, avg_cost); | ||
5820 | else | ||
5821 | nr = 4; | ||
5822 | } | ||
5823 | |||
5815 | time = local_clock(); | 5824 | time = local_clock(); |
5816 | 5825 | ||
5817 | for_each_cpu_wrap(cpu, sched_domain_span(sd), target) { | 5826 | for_each_cpu_wrap(cpu, sched_domain_span(sd), target) { |
5827 | if (!--nr) | ||
5828 | return -1; | ||
5818 | if (!cpumask_test_cpu(cpu, &p->cpus_allowed)) | 5829 | if (!cpumask_test_cpu(cpu, &p->cpus_allowed)) |
5819 | continue; | 5830 | continue; |
5820 | if (idle_cpu(cpu)) | 5831 | if (idle_cpu(cpu)) |