summaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2018-02-13 16:54:17 +0100
committerIngo Molnar <mingo@kernel.org>2018-03-09 07:59:22 +0100
commit63928384faefba1b31c3bb77361965715a9fc71c (patch)
treeb51ab9e5fbf6e597cbb4c99514201d245f918e02 /kernel/sched
parent1936c53ce8c8d4555e9ccad2dc8d98e0637b11f7 (diff)
downloadlinux-63928384faefba1b31c3bb77361965715a9fc71c.tar.bz2
sched/nohz: Optimize nohz_idle_balance()
Avoid calling update_blocked_averages() when it does not in fact have any by re-using/extending update_nohz_stats(). Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/fair.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index aad7c03dbad8..5c357561db5d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7898,7 +7898,7 @@ group_type group_classify(struct sched_group *group,
return group_other;
}
-static bool update_nohz_stats(struct rq *rq)
+static bool update_nohz_stats(struct rq *rq, bool force)
{
#ifdef CONFIG_NO_HZ_COMMON
unsigned int cpu = rq->cpu;
@@ -7909,7 +7909,7 @@ static bool update_nohz_stats(struct rq *rq)
if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
return false;
- if (!time_after(jiffies, rq->last_blocked_load_update_tick))
+ if (!force && !time_after(jiffies, rq->last_blocked_load_update_tick))
return true;
update_blocked_averages(cpu);
@@ -7942,7 +7942,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
for_each_cpu_and(i, sched_group_span(group), env->cpus) {
struct rq *rq = cpu_rq(i);
- if ((env->flags & LBF_NOHZ_STATS) && update_nohz_stats(rq))
+ if ((env->flags & LBF_NOHZ_STATS) && update_nohz_stats(rq, false))
env->flags |= LBF_NOHZ_AGAIN;
/* Bias balancing toward CPUs of our domain: */
@@ -9552,8 +9552,7 @@ static bool nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle)
rq = cpu_rq(balance_cpu);
- update_blocked_averages(rq->cpu);
- has_blocked_load |= rq->has_blocked_load;
+ has_blocked_load |= update_nohz_stats(rq, true);
/*
* If time for next balance is due,