aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorVincent Guittot <vincent.guittot@linaro.org>2014-08-26 07:06:47 -0400
committerIngo Molnar <mingo@kernel.org>2014-09-19 06:35:27 -0400
commit26bc3c50d3b3984564c270da86f1fbbfb774dbcd (patch)
treec925b5df1c144827950a0787c8d51dc1c24cba34 /kernel
parent65fdac08c264506ff95ee1e34ae066e308c9e6e3 (diff)
sched: Allow all architectures to set 'capacity_orig'
'capacity_orig' is only changed for systems with an SMT sched_domain level in order to reflect the lower capacity of CPUs. Heterogenous systems also have to reflect an original capacity that is different from the default value. Create a more generic function arch_scale_cpu_capacity that can be also used by non SMT platforms to set capacity_orig. The __weak implementation of arch_scale_cpu_capacity() is the previous SMT variant, in order to keep backward compatibility with the use of capacity_orig. arch_scale_smt_capacity() and default_scale_smt_capacity() have been removed as they were not used elsewhere than in arch_scale_cpu_capacity(). Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Reviewed-by: Preeti U. Murthy <preeti@linux.vnet.ibm.com> [ Added default_scale_cpu_capacity() back. ] Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: riel@redhat.com Cc: Morten.Rasmussen@arm.com Cc: efault@gmx.de Cc: nicolas.pitre@linaro.org Cc: daniel.lezcano@linaro.org Cc: dietmar.eggemann@arm.com Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/1409051215-16788-5-git-send-email-vincent.guittot@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/fair.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index eb87229ed4af..be530e40ceb9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5705,19 +5705,17 @@ unsigned long __weak arch_scale_freq_capacity(struct sched_domain *sd, int cpu)
5705 return default_scale_capacity(sd, cpu); 5705 return default_scale_capacity(sd, cpu);
5706} 5706}
5707 5707
5708static unsigned long default_scale_smt_capacity(struct sched_domain *sd, int cpu) 5708static unsigned long default_scale_cpu_capacity(struct sched_domain *sd, int cpu)
5709{ 5709{
5710 unsigned long weight = sd->span_weight; 5710 if ((sd->flags & SD_SHARE_CPUCAPACITY) && (sd->span_weight > 1))
5711 unsigned long smt_gain = sd->smt_gain; 5711 return sd->smt_gain / sd->span_weight;
5712 5712
5713 smt_gain /= weight; 5713 return SCHED_CAPACITY_SCALE;
5714
5715 return smt_gain;
5716} 5714}
5717 5715
5718unsigned long __weak arch_scale_smt_capacity(struct sched_domain *sd, int cpu) 5716unsigned long __weak arch_scale_cpu_capacity(struct sched_domain *sd, int cpu)
5719{ 5717{
5720 return default_scale_smt_capacity(sd, cpu); 5718 return default_scale_cpu_capacity(sd, cpu);
5721} 5719}
5722 5720
5723static unsigned long scale_rt_capacity(int cpu) 5721static unsigned long scale_rt_capacity(int cpu)
@@ -5756,18 +5754,15 @@ static unsigned long scale_rt_capacity(int cpu)
5756 5754
5757static void update_cpu_capacity(struct sched_domain *sd, int cpu) 5755static void update_cpu_capacity(struct sched_domain *sd, int cpu)
5758{ 5756{
5759 unsigned long weight = sd->span_weight;
5760 unsigned long capacity = SCHED_CAPACITY_SCALE; 5757 unsigned long capacity = SCHED_CAPACITY_SCALE;
5761 struct sched_group *sdg = sd->groups; 5758 struct sched_group *sdg = sd->groups;
5762 5759
5763 if ((sd->flags & SD_SHARE_CPUCAPACITY) && weight > 1) { 5760 if (sched_feat(ARCH_CAPACITY))
5764 if (sched_feat(ARCH_CAPACITY)) 5761 capacity *= arch_scale_cpu_capacity(sd, cpu);
5765 capacity *= arch_scale_smt_capacity(sd, cpu); 5762 else
5766 else 5763 capacity *= default_scale_cpu_capacity(sd, cpu);
5767 capacity *= default_scale_smt_capacity(sd, cpu);
5768 5764
5769 capacity >>= SCHED_CAPACITY_SHIFT; 5765 capacity >>= SCHED_CAPACITY_SHIFT;
5770 }
5771 5766
5772 sdg->sgc->capacity_orig = capacity; 5767 sdg->sgc->capacity_orig = capacity;
5773 5768