diff options
author | Peter Zijlstra <peterz@infradead.org> | 2013-07-04 00:56:46 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-07-23 06:22:06 -0400 |
commit | 7d9ffa8961482232d964173cccba6e14d2d543b2 (patch) | |
tree | 80fd615fb64b1bd82e0de0e5d1e8be2bae8cb06d /kernel/sched/core.c | |
parent | 62470419e993f8d9d93db0effd3af4296ecb79a5 (diff) |
sched: Micro-optimize the smart wake-affine logic
Smart wake-affine is using node-size as the factor currently, but the overhead
of the mask operation is high.
Thus, this patch introduce the 'sd_llc_size' percpu variable, which will record
the highest cache-share domain size, and make it to be the new factor, in order
to reduce the overhead and make it more reasonable.
Tested-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
Tested-by: Michael Wang <wangyun@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Michael Wang <wangyun@linux.vnet.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Link: http://lkml.kernel.org/r/51D5008E.6030102@linux.vnet.ibm.com
[ Tidied up the changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b7c32cb7bfeb..6df0fbe53767 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -5083,18 +5083,23 @@ static void destroy_sched_domains(struct sched_domain *sd, int cpu) | |||
5083 | * two cpus are in the same cache domain, see cpus_share_cache(). | 5083 | * two cpus are in the same cache domain, see cpus_share_cache(). |
5084 | */ | 5084 | */ |
5085 | DEFINE_PER_CPU(struct sched_domain *, sd_llc); | 5085 | DEFINE_PER_CPU(struct sched_domain *, sd_llc); |
5086 | DEFINE_PER_CPU(int, sd_llc_size); | ||
5086 | DEFINE_PER_CPU(int, sd_llc_id); | 5087 | DEFINE_PER_CPU(int, sd_llc_id); |
5087 | 5088 | ||
5088 | static void update_top_cache_domain(int cpu) | 5089 | static void update_top_cache_domain(int cpu) |
5089 | { | 5090 | { |
5090 | struct sched_domain *sd; | 5091 | struct sched_domain *sd; |
5091 | int id = cpu; | 5092 | int id = cpu; |
5093 | int size = 1; | ||
5092 | 5094 | ||
5093 | sd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES); | 5095 | sd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES); |
5094 | if (sd) | 5096 | if (sd) { |
5095 | id = cpumask_first(sched_domain_span(sd)); | 5097 | id = cpumask_first(sched_domain_span(sd)); |
5098 | size = cpumask_weight(sched_domain_span(sd)); | ||
5099 | } | ||
5096 | 5100 | ||
5097 | rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); | 5101 | rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); |
5102 | per_cpu(sd_llc_size, cpu) = size; | ||
5098 | per_cpu(sd_llc_id, cpu) = id; | 5103 | per_cpu(sd_llc_id, cpu) = id; |
5099 | } | 5104 | } |
5100 | 5105 | ||