aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValentin Schneider <valentin.schneider@arm.com>2019-01-17 10:34:07 -0500
committerIngo Molnar <mingo@kernel.org>2019-02-11 02:02:16 -0500
commit7edab78d7400ea0997f8e2e971004d824b5bb511 (patch)
treec6f0742d07fadac97ce26f0be924ea723309509d
parent99687cdbb3f6c8e32bcc7f37496e811f30460e48 (diff)
sched/fair: Simplify nohz_balancer_kick()
Calling 'nohz_balance_exit_idle(rq)' will always clear 'rq->cpu' from 'nohz.idle_cpus_mask' if it is set. Since it is called at the top of 'nohz_balancer_kick()', 'rq->cpu' will never be set in 'nohz.idle_cpus_mask' if it is accessed in the rest of the function. Combine the 'sched_domain_span()' with 'nohz.idle_cpus_mask' and drop the '(i == cpu)' check since 'rq->cpu' will never be iterated over. While at it, clean up a condition alignment. Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Dietmar.Eggemann@arm.com Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: morten.rasmussen@arm.com Cc: vincent.guittot@linaro.org Link: https://lkml.kernel.org/r/20190117153411.2390-2-valentin.schneider@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/sched/fair.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 58edbbdeb661..0692c8ff6ff6 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9615,7 +9615,7 @@ static void nohz_balancer_kick(struct rq *rq)
9615 sd = rcu_dereference(rq->sd); 9615 sd = rcu_dereference(rq->sd);
9616 if (sd) { 9616 if (sd) {
9617 if ((rq->cfs.h_nr_running >= 1) && 9617 if ((rq->cfs.h_nr_running >= 1) &&
9618 check_cpu_capacity(rq, sd)) { 9618 check_cpu_capacity(rq, sd)) {
9619 flags = NOHZ_KICK_MASK; 9619 flags = NOHZ_KICK_MASK;
9620 goto unlock; 9620 goto unlock;
9621 } 9621 }
@@ -9623,11 +9623,7 @@ static void nohz_balancer_kick(struct rq *rq)
9623 9623
9624 sd = rcu_dereference(per_cpu(sd_asym_packing, cpu)); 9624 sd = rcu_dereference(per_cpu(sd_asym_packing, cpu));
9625 if (sd) { 9625 if (sd) {
9626 for_each_cpu(i, sched_domain_span(sd)) { 9626 for_each_cpu_and(i, sched_domain_span(sd), nohz.idle_cpus_mask) {
9627 if (i == cpu ||
9628 !cpumask_test_cpu(i, nohz.idle_cpus_mask))
9629 continue;
9630
9631 if (sched_asym_prefer(i, cpu)) { 9627 if (sched_asym_prefer(i, cpu)) {
9632 flags = NOHZ_KICK_MASK; 9628 flags = NOHZ_KICK_MASK;
9633 goto unlock; 9629 goto unlock;