aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2014-05-26 18:19:37 -0400
committerIngo Molnar <mingo@kernel.org>2014-06-05 05:52:26 -0400
commit63b2ca30bdb3dbf60bc7ac5f46713c0d32308261 (patch)
treeeda6000f59abf091fb53812505d5d0ffb67d4a8f
parent0fedc6c8e34f4ce0b37b1f25c3619b4a8faa244c (diff)
sched: Let 'struct sched_group_power' care about CPU capacity
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. Since struct sched_group_power is really about compute capacity of sched groups, let's rename it to struct sched_group_capacity. Similarly sgp becomes sgc. Related variables and functions dealing with groups are also adjusted accordingly. 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-5yeix833vvgf2uyj5o36hpu9@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/linux/sched.h2
-rw-r--r--kernel/sched/core.c81
-rw-r--r--kernel/sched/fair.c131
-rw-r--r--kernel/sched/sched.h16
4 files changed, 115 insertions, 115 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6790c3b42072..a96f03598c61 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1013,7 +1013,7 @@ typedef const int (*sched_domain_flags_f)(void);
1013struct sd_data { 1013struct sd_data {
1014 struct sched_domain **__percpu sd; 1014 struct sched_domain **__percpu sd;
1015 struct sched_group **__percpu sg; 1015 struct sched_group **__percpu sg;
1016 struct sched_group_power **__percpu sgp; 1016 struct sched_group_capacity **__percpu sgc;
1017}; 1017};
1018 1018
1019struct sched_domain_topology_level { 1019struct sched_domain_topology_level {
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index afcc84234a3e..2e1fb0902200 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5221,14 +5221,13 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
5221 } 5221 }
5222 5222
5223 /* 5223 /*
5224 * Even though we initialize ->power to something semi-sane, 5224 * Even though we initialize ->capacity to something semi-sane,
5225 * we leave power_orig unset. This allows us to detect if 5225 * we leave capacity_orig unset. This allows us to detect if
5226 * domain iteration is still funny without causing /0 traps. 5226 * domain iteration is still funny without causing /0 traps.
5227 */ 5227 */
5228 if (!group->sgp->power_orig) { 5228 if (!group->sgc->capacity_orig) {
5229 printk(KERN_CONT "\n"); 5229 printk(KERN_CONT "\n");
5230 printk(KERN_ERR "ERROR: domain->cpu_power not " 5230 printk(KERN_ERR "ERROR: domain->cpu_capacity not set\n");
5231 "set\n");
5232 break; 5231 break;
5233 } 5232 }
5234 5233
@@ -5250,9 +5249,9 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
5250 cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group)); 5249 cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group));
5251 5250
5252 printk(KERN_CONT " %s", str); 5251 printk(KERN_CONT " %s", str);
5253 if (group->sgp->power != SCHED_POWER_SCALE) { 5252 if (group->sgc->capacity != SCHED_POWER_SCALE) {
5254 printk(KERN_CONT " (cpu_power = %d)", 5253 printk(KERN_CONT " (cpu_capacity = %d)",
5255 group->sgp->power); 5254 group->sgc->capacity);
5256 } 5255 }
5257 5256
5258 group = group->next; 5257 group = group->next;
@@ -5466,7 +5465,7 @@ static struct root_domain *alloc_rootdomain(void)
5466 return rd; 5465 return rd;
5467} 5466}
5468 5467
5469static void free_sched_groups(struct sched_group *sg, int free_sgp) 5468static void free_sched_groups(struct sched_group *sg, int free_sgc)
5470{ 5469{
5471 struct sched_group *tmp, *first; 5470 struct sched_group *tmp, *first;
5472 5471
@@ -5477,8 +5476,8 @@ static void free_sched_groups(struct sched_group *sg, int free_sgp)
5477 do { 5476 do {
5478 tmp = sg->next; 5477 tmp = sg->next;
5479 5478
5480 if (free_sgp && atomic_dec_and_test(&sg->sgp->ref)) 5479 if (free_sgc && atomic_dec_and_test(&sg->sgc->ref))
5481 kfree(sg->sgp); 5480 kfree(sg->sgc);
5482 5481
5483 kfree(sg); 5482 kfree(sg);
5484 sg = tmp; 5483 sg = tmp;
@@ -5496,7 +5495,7 @@ static void free_sched_domain(struct rcu_head *rcu)
5496 if (sd->flags & SD_OVERLAP) { 5495 if (sd->flags & SD_OVERLAP) {
5497 free_sched_groups(sd->groups, 1); 5496 free_sched_groups(sd->groups, 1);
5498 } else if (atomic_dec_and_test(&sd->groups->ref)) { 5497 } else if (atomic_dec_and_test(&sd->groups->ref)) {
5499 kfree(sd->groups->sgp); 5498 kfree(sd->groups->sgc);
5500 kfree(sd->groups); 5499 kfree(sd->groups);
5501 } 5500 }
5502 kfree(sd); 5501 kfree(sd);
@@ -5707,17 +5706,17 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu)
5707 5706
5708 cpumask_or(covered, covered, sg_span); 5707 cpumask_or(covered, covered, sg_span);
5709 5708
5710 sg->sgp = *per_cpu_ptr(sdd->sgp, i); 5709 sg->sgc = *per_cpu_ptr(sdd->sgc, i);
5711 if (atomic_inc_return(&sg->sgp->ref) == 1) 5710 if (atomic_inc_return(&sg->sgc->ref) == 1)
5712 build_group_mask(sd, sg); 5711 build_group_mask(sd, sg);
5713 5712
5714 /* 5713 /*
5715 * Initialize sgp->power such that even if we mess up the 5714 * Initialize sgc->capacity such that even if we mess up the
5716 * domains and no possible iteration will get us here, we won't 5715 * domains and no possible iteration will get us here, we won't
5717 * die on a /0 trap. 5716 * die on a /0 trap.
5718 */ 5717 */
5719 sg->sgp->power = SCHED_POWER_SCALE * cpumask_weight(sg_span); 5718 sg->sgc->capacity = SCHED_POWER_SCALE * cpumask_weight(sg_span);
5720 sg->sgp->power_orig = sg->sgp->power; 5719 sg->sgc->capacity_orig = sg->sgc->capacity;
5721 5720
5722 /* 5721 /*
5723 * Make sure the first group of this domain contains the 5722 * Make sure the first group of this domain contains the
@@ -5755,8 +5754,8 @@ static int get_group(int cpu, struct sd_data *sdd, struct sched_group **sg)
5755 5754
5756 if (sg) { 5755 if (sg) {
5757 *sg = *per_cpu_ptr(sdd->sg, cpu); 5756 *sg = *per_cpu_ptr(sdd->sg, cpu);
5758 (*sg)->sgp = *per_cpu_ptr(sdd->sgp, cpu); 5757 (*sg)->sgc = *per_cpu_ptr(sdd->sgc, cpu);
5759 atomic_set(&(*sg)->sgp->ref, 1); /* for claim_allocations */ 5758 atomic_set(&(*sg)->sgc->ref, 1); /* for claim_allocations */
5760 } 5759 }
5761 5760
5762 return cpu; 5761 return cpu;
@@ -5819,16 +5818,16 @@ build_sched_groups(struct sched_domain *sd, int cpu)
5819} 5818}
5820 5819
5821/* 5820/*
5822 * Initialize sched groups cpu_power. 5821 * Initialize sched groups cpu_capacity.
5823 * 5822 *
5824 * cpu_power indicates the capacity of sched group, which is used while 5823 * cpu_capacity indicates the capacity of sched group, which is used while
5825 * distributing the load between different sched groups in a sched domain. 5824 * distributing the load between different sched groups in a sched domain.
5826 * Typically cpu_power for all the groups in a sched domain will be same unless 5825 * Typically cpu_capacity for all the groups in a sched domain will be same
5827 * there are asymmetries in the topology. If there are asymmetries, group 5826 * unless there are asymmetries in the topology. If there are asymmetries,
5828 * having more cpu_power will pickup more load compared to the group having 5827 * group having more cpu_capacity will pickup more load compared to the
5829 * less cpu_power. 5828 * group having less cpu_capacity.
5830 */ 5829 */
5831static void init_sched_groups_power(int cpu, struct sched_domain *sd) 5830static void init_sched_groups_capacity(int cpu, struct sched_domain *sd)
5832{ 5831{
5833 struct sched_group *sg = sd->groups; 5832 struct sched_group *sg = sd->groups;
5834 5833
@@ -5842,8 +5841,8 @@ static void init_sched_groups_power(int cpu, struct sched_domain *sd)
5842 if (cpu != group_balance_cpu(sg)) 5841 if (cpu != group_balance_cpu(sg))
5843 return; 5842 return;
5844 5843
5845 update_group_power(sd, cpu); 5844 update_group_capacity(sd, cpu);
5846 atomic_set(&sg->sgp->nr_busy_cpus, sg->group_weight); 5845 atomic_set(&sg->sgc->nr_busy_cpus, sg->group_weight);
5847} 5846}
5848 5847
5849/* 5848/*
@@ -5934,8 +5933,8 @@ static void claim_allocations(int cpu, struct sched_domain *sd)
5934 if (atomic_read(&(*per_cpu_ptr(sdd->sg, cpu))->ref)) 5933 if (atomic_read(&(*per_cpu_ptr(sdd->sg, cpu))->ref))
5935 *per_cpu_ptr(sdd->sg, cpu) = NULL; 5934 *per_cpu_ptr(sdd->sg, cpu) = NULL;
5936 5935
5937 if (atomic_read(&(*per_cpu_ptr(sdd->sgp, cpu))->ref)) 5936 if (atomic_read(&(*per_cpu_ptr(sdd->sgc, cpu))->ref))
5938 *per_cpu_ptr(sdd->sgp, cpu) = NULL; 5937 *per_cpu_ptr(sdd->sgc, cpu) = NULL;
5939} 5938}
5940 5939
5941#ifdef CONFIG_NUMA 5940#ifdef CONFIG_NUMA
@@ -6337,14 +6336,14 @@ static int __sdt_alloc(const struct cpumask *cpu_map)
6337 if (!sdd->sg) 6336 if (!sdd->sg)