All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Vincent Guittot" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Valentin Schneider <valentin.schneider@arm.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] sched/fair: Remove update of blocked load from newidle_balance
Date: Tue, 02 Mar 2021 09:01:55 -0000	[thread overview]
Message-ID: <161467571597.20312.15461052399950119430.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210224133007.28644-2-vincent.guittot@linaro.org>

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     06a35afe89800789fc47ca5c41fbe435cc77d8e0
Gitweb:        https://git.kernel.org/tip/06a35afe89800789fc47ca5c41fbe435cc77d8e0
Author:        Vincent Guittot <vincent.guittot@linaro.org>
AuthorDate:    Wed, 24 Feb 2021 14:30:01 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 01 Mar 2021 18:17:23 +01:00

sched/fair: Remove update of blocked load from newidle_balance

newidle_balance runs with both preempt and irq disabled which prevent
local irq to run during this period. The duration for updating the
blocked load of CPUs varies according to the number of CPU cgroups
with non-decayed load and extends this critical period to an uncontrolled
level.

Remove the update from newidle_balance and trigger a normal ILB that
will take care of the update instead.

This reduces the IRQ latency from O(nr_cgroups * nr_nohz_cpus) to
O(nr_cgroups).

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/20210224133007.28644-2-vincent.guittot@linaro.org
---
 kernel/sched/fair.c | 33 +++++----------------------------
 1 file changed, 5 insertions(+), 28 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 794c2cb..806e16f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7392,8 +7392,6 @@ enum migration_type {
 #define LBF_NEED_BREAK	0x02
 #define LBF_DST_PINNED  0x04
 #define LBF_SOME_PINNED	0x08
-#define LBF_NOHZ_STATS	0x10
-#define LBF_NOHZ_AGAIN	0x20
 
 struct lb_env {
 	struct sched_domain	*sd;
@@ -8397,9 +8395,6 @@ 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, false))
-			env->flags |= LBF_NOHZ_AGAIN;
-
 		sgs->group_load += cpu_load(rq);
 		sgs->group_util += cpu_util(i);
 		sgs->group_runnable += cpu_runnable(rq);
@@ -8940,11 +8935,6 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
 	struct sg_lb_stats tmp_sgs;
 	int sg_status = 0;
 
-#ifdef CONFIG_NO_HZ_COMMON
-	if (env->idle == CPU_NEWLY_IDLE && READ_ONCE(nohz.has_blocked))
-		env->flags |= LBF_NOHZ_STATS;
-#endif
-
 	do {
 		struct sg_lb_stats *sgs = &tmp_sgs;
 		int local_group;
@@ -8981,14 +8971,6 @@ next_group:
 	/* Tag domain that child domain prefers tasks go to siblings first */
 	sds->prefer_sibling = child && child->flags & SD_PREFER_SIBLING;
 
-#ifdef CONFIG_NO_HZ_COMMON
-	if ((env->flags & LBF_NOHZ_AGAIN) &&
-	    cpumask_subset(nohz.idle_cpus_mask, sched_domain_span(env->sd))) {
-
-		WRITE_ONCE(nohz.next_blocked,
-			   jiffies + msecs_to_jiffies(LOAD_AVG_PERIOD));
-	}
-#endif
 
 	if (env->sd->flags & SD_NUMA)
 		env->fbq_type = fbq_classify_group(&sds->busiest_stat);
@@ -10517,16 +10499,11 @@ static void nohz_newidle_balance(struct rq *this_rq)
 	    time_before(jiffies, READ_ONCE(nohz.next_blocked)))
 		return;
 
-	raw_spin_unlock(&this_rq->lock);
 	/*
-	 * This CPU is going to be idle and blocked load of idle CPUs
-	 * need to be updated. Run the ilb locally as it is a good
-	 * candidate for ilb instead of waking up another idle CPU.
-	 * Kick an normal ilb if we failed to do the update.
+	 * Blocked load of idle CPUs need to be updated.
+	 * Kick an ILB to update statistics.
 	 */
-	if (!_nohz_idle_balance(this_rq, NOHZ_STATS_KICK, CPU_NEWLY_IDLE))
-		kick_ilb(NOHZ_STATS_KICK);
-	raw_spin_lock(&this_rq->lock);
+	kick_ilb(NOHZ_STATS_KICK);
 }
 
 #else /* !CONFIG_NO_HZ_COMMON */
@@ -10587,8 +10564,6 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf)
 			update_next_balance(sd, &next_balance);
 		rcu_read_unlock();
 
-		nohz_newidle_balance(this_rq);
-
 		goto out;
 	}
 
@@ -10654,6 +10629,8 @@ out:
 
 	if (pulled_task)
 		this_rq->idle_stamp = 0;
+	else
+		nohz_newidle_balance(this_rq);
 
 	rq_repin_lock(this_rq, rf);
 

  reply	other threads:[~2021-03-02  9:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 13:30 [PATCH 0/7 v4] move update blocked load outside newidle_balance Vincent Guittot
2021-02-24 13:30 ` [PATCH 1/7 v4] sched/fair: remove update of blocked load from newidle_balance Vincent Guittot
2021-03-02  9:01   ` tip-bot2 for Vincent Guittot [this message]
2021-03-03  9:49   ` [tip: sched/core] sched/fair: Remove " tip-bot2 for Vincent Guittot
2021-03-06 11:42   ` tip-bot2 for Vincent Guittot
2021-02-24 13:30 ` [PATCH 2/7 v4] sched/fair: remove unused return of _nohz_idle_balance Vincent Guittot
2021-03-02  9:01   ` [tip: sched/core] sched/fair: Remove " tip-bot2 for Vincent Guittot
2021-03-03  9:49   ` tip-bot2 for Vincent Guittot
2021-03-06 11:42   ` tip-bot2 for Vincent Guittot
2021-02-24 13:30 ` [PATCH 3/7 v4] sched/fair: remove unused parameter of update_nohz_stats Vincent Guittot
2021-03-02  9:01   ` [tip: sched/core] sched/fair: Remove " tip-bot2 for Vincent Guittot
2021-03-03  9:49   ` tip-bot2 for Vincent Guittot
2021-03-05 13:55   ` [PATCH 3/7 v4] sched/fair: remove " Qais Yousef
2021-03-06 11:42   ` [tip: sched/core] sched/fair: Remove " tip-bot2 for Vincent Guittot
2021-02-24 13:30 ` [PATCH 4/7 v4] sched/fair: merge for each idle cpu loop of ILB Vincent Guittot
2021-03-02  9:01   ` [tip: sched/core] sched/fair: Merge " tip-bot2 for Vincent Guittot
2021-03-03  9:49   ` tip-bot2 for Vincent Guittot
2021-03-06 11:42   ` tip-bot2 for Vincent Guittot
2021-02-24 13:30 ` [PATCH 5/7 v4] sched/fair: reorder newidle_balance pulled_task tests Vincent Guittot
2021-03-02  9:01   ` [tip: sched/core] sched/fair: Reorder " tip-bot2 for Vincent Guittot
2021-03-03  9:49   ` tip-bot2 for Vincent Guittot
2021-03-06 11:42   ` tip-bot2 for Vincent Guittot
2021-02-24 13:30 ` [PATCH 6/7 v4] sched/fair: trigger the update of blocked load on newly idle cpu Vincent Guittot
2021-03-02  9:01   ` [tip: sched/core] sched/fair: Trigger " tip-bot2 for Vincent Guittot
2021-03-03  9:49   ` tip-bot2 for Vincent Guittot
2021-03-05 13:52   ` [PATCH 6/7 v4] sched/fair: trigger " Qais Yousef
2021-03-06 11:42   ` [tip: sched/core] sched/fair: Trigger " tip-bot2 for Vincent Guittot
2021-02-24 13:30 ` [PATCH 7/7 v4] sched/fair: reduce the window for duplicated update Vincent Guittot
2021-03-02  9:01   ` [tip: sched/core] sched/fair: Reduce " tip-bot2 for Vincent Guittot
2021-03-03  9:49   ` tip-bot2 for Vincent Guittot
2021-03-06 11:42   ` tip-bot2 for Vincent Guittot
2021-02-24 15:53 ` [PATCH 0/7 v4] move update blocked load outside newidle_balance Peter Zijlstra
2021-02-24 15:57   ` Vincent Guittot
2021-02-24 17:41     ` Peter Zijlstra
2021-02-24 17:51       ` Vincent Guittot
2021-02-24 18:17         ` Peter Zijlstra
2021-02-24 18:46 ` Valentin Schneider
2021-02-25  8:05   ` Vincent Guittot
2021-02-25 12:14     ` Valentin Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161467571597.20312.15461052399950119430.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.