aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2014-05-26 18:19:38 -0400
committerIngo Molnar <mingo@kernel.org>2014-06-05 05:52:29 -0400
commitced549fa5fc1fdaf7fac93894dc673092eb3dc20 (patch)
tree83b391620a9b1d269de50e06f8d03714b59298d6
parent63b2ca30bdb3dbf60bc7ac5f46713c0d32308261 (diff)
sched: Remove remaining dubious usage of "power"
It is better not to think about compute capacity as being equivalent to "CPU power". The upcoming "power aware" scheduler work may create confusion with the notion of energy consumption if "power" is used too liberally. This is the remaining "power" -> "capacity" rename for local symbols. Those symbols visible to the rest of the kernel are not included yet. Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Morten Rasmussen <morten.rasmussen@arm.com> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: linaro-kernel@lists.linaro.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/n/tip-yyyhohzhkwnaotr3lx8zd5aa@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/sched/core.c6
-rw-r--r--kernel/sched/fair.c102
-rw-r--r--kernel/sched/sched.h2
3 files changed, 55 insertions, 55 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2e1fb0902200..07bc78a50329 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5764,7 +5764,7 @@ static int get_group(int cpu, struct sd_data *sdd, struct sched_group **sg)
5764/* 5764/*
5765 * build_sched_groups will build a circular linked list of the groups 5765 * build_sched_groups will build a circular linked list of the groups
5766 * covered by the given span, and will set each group's ->cpumask correctly, 5766 * covered by the given span, and will set each group's ->cpumask correctly,
5767 * and ->cpu_power to 0. 5767 * and ->cpu_capacity to 0.
5768 * 5768 *
5769 * Assumes the sched_domain tree is fully constructed 5769 * Assumes the sched_domain tree is fully constructed
5770 */ 5770 */
@@ -6471,7 +6471,7 @@ static int build_sched_domains(const struct cpumask *cpu_map,
6471 } 6471 }
6472 } 6472 }
6473 6473
6474 /* Calculate CPU power for physical packages and nodes */ 6474 /* Calculate CPU capacity for physical packages and nodes */
6475 for (i = nr_cpumask_bits-1; i >= 0; i--) { 6475 for (i = nr_cpumask_bits-1; i >= 0; i--) {
6476 if (!cpumask_test_cpu(i, cpu_map)) 6476 if (!cpumask_test_cpu(i, cpu_map))
6477 continue; 6477 continue;
@@ -6921,7 +6921,7 @@ void __init sched_init(void)
6921#ifdef CONFIG_SMP 6921#ifdef CONFIG_SMP
6922 rq->sd = NULL; 6922 rq->sd = NULL;
6923 rq->rd = NULL; 6923 rq->rd = NULL;
6924 rq->cpu_power = SCHED_POWER_SCALE; 6924 rq->cpu_capacity = SCHED_POWER_SCALE;
6925 rq->post_schedule = 0; 6925 rq->post_schedule = 0;
6926 rq->active_balance = 0; 6926 rq->active_balance = 0;
6927 rq->next_balance = jiffies; 6927 rq->next_balance = jiffies;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 36bd4d23fca8..58684f684fa8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1017,7 +1017,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
1017static unsigned long weighted_cpuload(const int cpu); 1017static unsigned long weighted_cpuload(const int cpu);
1018static unsigned long source_load(int cpu, int type); 1018static unsigned long source_load(int cpu, int type);
1019static unsigned long target_load(int cpu, int type); 1019static unsigned long target_load(int cpu, int type);
1020static unsigned long power_of(int cpu); 1020static unsigned long capacity_of(int cpu);
1021static long effective_load(struct task_group *tg, int cpu, long wl, long wg); 1021static long effective_load(struct task_group *tg, int cpu, long wl, long wg);
1022 1022
1023/* Cached statistics for all CPUs within a node */ 1023/* Cached statistics for all CPUs within a node */
@@ -1046,7 +1046,7 @@ static void update_numa_stats(struct numa_stats *ns, int nid)
1046 1046
1047 ns->nr_running += rq->nr_running; 1047 ns->nr_running += rq->nr_running;
1048 ns->load += weighted_cpuload(cpu); 1048 ns->load += weighted_cpuload(cpu);
1049 ns->compute_capacity += power_of(cpu); 1049 ns->compute_capacity += capacity_of(cpu);
1050 1050
1051 cpus++; 1051 cpus++;
1052 } 1052 }
@@ -1214,7 +1214,7 @@ balance:
1214 orig_dst_load = env->dst_stats.load; 1214 orig_dst_load = env->dst_stats.load;
1215 orig_src_load = env->src_stats.load; 1215 orig_src_load = env->src_stats.load;
1216 1216
1217 /* XXX missing power terms */ 1217 /* XXX missing capacity terms */
1218 load = task_h_load(env->p); 1218 load = task_h_load(env->p);
1219 dst_load = orig_dst_load + load; 1219 dst_load = orig_dst_load + load;
1220 src_load = orig_src_load - load; 1220 src_load = orig_src_load - load;
@@ -4043,9 +4043,9 @@ static unsigned long target_load(int cpu, int type)
4043 return max(rq->cpu_load[type-1], total); 4043 return max(rq->cpu_load[type-1], total);
4044} 4044}
4045 4045
4046static unsigned long power_of(int cpu) 4046static unsigned long capacity_of(int cpu)
4047{ 4047{
4048 return cpu_rq(cpu)->cpu_power; 4048 return cpu_rq(cpu)->cpu_capacity;
4049} 4049}
4050 4050
4051static unsigned long cpu_avg_load_per_task(int cpu) 4051static unsigned long cpu_avg_load_per_task(int cpu)
@@ -4288,12 +4288,12 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
4288 s64 this_eff_load, prev_eff_load; 4288 s64 this_eff_load, prev_eff_load;
4289 4289
4290 this_eff_load = 100; 4290 this_eff_load = 100;
4291 this_eff_load *= power_of(prev_cpu); 4291 this_eff_load *= capacity_of(prev_cpu);
4292 this_eff_load *= this_load + 4292 this_eff_load *= this_load +
4293 effective_load(tg, this_cpu, weight, weight); 4293 effective_load(tg, this_cpu, weight, weight);
4294 4294
4295 prev_eff_load = 100 + (sd->imbalance_pct - 100) / 2; 4295 prev_eff_load = 100 + (sd->imbalance_pct - 100) / 2;
4296 prev_eff_load *= power_of(this_cpu); 4296 prev_eff_load *= capacity_of(this_cpu);
4297 prev_eff_load *= load + effective_load(tg, prev_cpu, 0, weight); 4297 prev_eff_load *= load + effective_load(tg, prev_cpu, 0, weight);
4298 4298
4299 balanced = this_eff_load <= prev_eff_load; 4299 balanced = this_eff_load <= prev_eff_load;
@@ -4950,14 +4950,14 @@ static bool yield_to_task_fair(struct rq *rq, struct task_struct *p, bool preemp
4950 * 4950 *
4951 * W'_i,n = (2^n - 1) / 2^n * W_i,n + 1 / 2^n * W_i,0 (3) 4951 * W'_i,n = (2^n - 1) / 2^n * W_i,n + 1 / 2^n * W_i,0 (3)
4952 * 4952 *
4953 * P_i is the cpu power (or compute capacity) of cpu i, typically it is the 4953 * C_i is the compute capacity of cpu i, typically it is the
4954 * fraction of 'recent' time available for SCHED_OTHER task execution. But it 4954 * fraction of 'recent' time available for SCHED_OTHER task execution. But it
4955 * can also include other factors [XXX]. 4955 * can also include other factors [XXX].
4956 * 4956 *
4957 * To achieve this balance we define a measure of imbalance which follows 4957 * To achieve this balance we define a measure of imbalance which follows
4958 * directly from (1): 4958 * directly from (1):
4959 * 4959 *
4960 * imb_i,j = max{ avg(W/P), W_i/P_i } - min{ avg(W/P), W_j/P_j } (4) 4960 * imb_i,j = max{ avg(W/C), W_i/C_i } - min{ avg(W/C), W_j/C_j } (4)
4961 * 4961 *
4962 * We them move tasks around to minimize the imbalance. In the continuous 4962 * We them move tasks around to minimize the imbalance. In the continuous
4963 * function space it is obvious this converges, in the discrete case we get 4963 * function space it is obvious this converges, in the discrete case we get
@@ -5607,17 +5607,17 @@ static inline int get_sd_load_idx(struct sched_domain *sd,
5607 return load_idx; 5607 return load_idx;
5608} 5608}
5609 5609
5610static unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu) 5610static unsigned long default_scale_capacity(struct sched_domain *sd, int cpu)
5611{ 5611{
5612 return SCHED_POWER_SCALE; 5612 return SCHED_POWER_SCALE;
5613} 5613}
5614 5614
5615unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu) 5615unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu)
5616{ 5616{
5617 return default_scale_freq_power(sd, cpu); 5617 return default_scale_capacity(sd, cpu);
5618} 5618}
5619 5619
5620static unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu) 5620static unsigned long default_scale_smt_capacity(struct sched_domain *sd, int cpu)
5621{ 5621{
5622 unsigned long weight = sd->span_weight; 5622 unsigned long weight = sd->span_weight;
5623 unsigned long smt_gain = sd->smt_gain; 5623 unsigned long smt_gain = sd->smt_gain;
@@ -5629,10 +5629,10 @@ static unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
5629 5629
5630unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu) 5630unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
5631{ 5631{
5632 return default_scale_smt_power(sd, cpu); 5632 return default_scale_smt_capacity(sd, cpu);
5633} 5633}
5634 5634
5635static unsigned long scale_rt_power(int cpu) 5635static unsigned long scale_rt_capacity(int cpu)
5636{ 5636{
5637 struct rq *rq = cpu_rq(cpu); 5637 struct rq *rq = cpu_rq(cpu);
5638 u64 total, available, age_stamp, avg; 5638 u64 total, available, age_stamp, avg;
@@ -5652,7 +5652,7 @@ static unsigned long scale_rt_power(int cpu)
5652 total = sched_avg_period() + delta; 5652 total = sched_avg_period() + delta;
5653 5653
5654 if (unlikely(total < avg)) { 5654 if (unlikely(total < avg)) {
5655 /* Ensures that power won't end up being negative */ 5655 /* Ensures that capacity won't end up being negative */
5656 available = 0; 5656 available = 0;
5657 } else { 5657 } else {
5658 available = total - avg; 5658 available = total - avg;
@@ -5666,38 +5666,38 @@ static unsigned long scale_rt_power(int cpu)
5666 return div_u64(available, total); 5666 return div_u64(available, total);
5667} 5667}
5668 5668
5669static void update_cpu_power(struct sched_domain *sd, int cpu)