diff options
author | Rik van Riel <riel@redhat.com> | 2014-08-04 13:23:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-08-12 06:48:23 -0400 |
commit | 83d7f2424741c9dc76c21377c9d00d47abaf88df (patch) | |
tree | eddb9a5732788c00247c3bb430b14bea4bc6c953 /kernel/sched/fair.c | |
parent | b932c03c34f3b03c7364c06aa8cae5b74609fc41 (diff) |
sched/numa: Fix numa capacity computation
Commit c61037e9 fixes the phenomenon of 'fantom' cores due to
N*frac(smt_power) >= 1 by limiting the capacity to the actual
number of cores in the load balancing code.
This patch applies the same correction to the NUMA balancing
code.
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: mgorman@suse.de
Cc: vincent.guittot@linaro.org
Cc: Morten.Rasmussen@arm.com
Cc: nicolas.pitre@linaro.org
Cc: efault@gmx.de
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1407173008-9334-3-git-send-email-riel@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r-- | kernel/sched/fair.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e1cf419c3c7f..1413c44ce8a1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -1038,7 +1038,8 @@ struct numa_stats { | |||
1038 | */ | 1038 | */ |
1039 | static void update_numa_stats(struct numa_stats *ns, int nid) | 1039 | static void update_numa_stats(struct numa_stats *ns, int nid) |
1040 | { | 1040 | { |
1041 | int cpu, cpus = 0; | 1041 | int smt, cpu, cpus = 0; |
1042 | unsigned long capacity; | ||
1042 | 1043 | ||
1043 | memset(ns, 0, sizeof(*ns)); | 1044 | memset(ns, 0, sizeof(*ns)); |
1044 | for_each_cpu(cpu, cpumask_of_node(nid)) { | 1045 | for_each_cpu(cpu, cpumask_of_node(nid)) { |
@@ -1062,8 +1063,12 @@ static void update_numa_stats(struct numa_stats *ns, int nid) | |||
1062 | if (!cpus) | 1063 | if (!cpus) |
1063 | return; | 1064 | return; |
1064 | 1065 | ||
1065 | ns->task_capacity = | 1066 | /* smt := ceil(cpus / capacity), assumes: 1 < smt_power < 2 */ |
1066 | DIV_ROUND_CLOSEST(ns->compute_capacity, SCHED_CAPACITY_SCALE); | 1067 | smt = DIV_ROUND_UP(SCHED_CAPACITY_SCALE * cpus, ns->compute_capacity); |
1068 | capacity = cpus / smt; /* cores */ | ||
1069 | |||
1070 | ns->task_capacity = min_t(unsigned, capacity, | ||
1071 | DIV_ROUND_CLOSEST(ns->compute_capacity, SCHED_CAPACITY_SCALE)); | ||
1067 | ns->has_free_capacity = (ns->nr_running < ns->task_capacity); | 1072 | ns->has_free_capacity = (ns->nr_running < ns->task_capacity); |
1068 | } | 1073 | } |
1069 | 1074 | ||