linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Donnefort <vincent.donnefort@arm.com>
To: peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org
Cc: linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com,
	valentin.schneider@arm.com, morten.rasmussen@arm.com,
	qperret@google.com, Vincent Donnefort <vincent.donnefort@arm.com>
Subject: [PATCH 3/3] sched/fair: Do not raise overutilized for idle CPUs
Date: Mon, 20 Dec 2021 12:43:23 +0100	[thread overview]
Message-ID: <20211220114323.22811-4-vincent.donnefort@arm.com> (raw)
In-Reply-To: <20211220114323.22811-1-vincent.donnefort@arm.com>

During a migration, the lock for the previous runqueue is not taken and
hence, the task contribution isn't directly removed from that runqueue
utilization but instead temporarily saved, until the next PELT signals
update where it would be accounted. There is then a window in which a
CPU can ben idle be nonetheless overutilized.

The load balancer wouldn't be able to do anything to help a sleeping CPU,
it brings then no gain to raise overutilized there, only the risk of
spuriously doing it.

Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 51f6f55abb37..37f737c5f0b8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8641,26 +8641,28 @@ static inline void update_sg_lb_stats(struct lb_env *env,
 
 		nr_running = rq->nr_running;
 		sgs->sum_nr_running += nr_running;
-
-		if (nr_running > 1)
-			*sg_status |= SG_OVERLOAD;
-
-		if (cpu_overutilized(i))
-			*sg_status |= SG_OVERUTILIZED;
-
 #ifdef CONFIG_NUMA_BALANCING
 		sgs->nr_numa_running += rq->nr_numa_running;
 		sgs->nr_preferred_running += rq->nr_preferred_running;
 #endif
+		if (nr_running > 1)
+			*sg_status |= SG_OVERLOAD;
+
 		/*
 		 * No need to call idle_cpu() if nr_running is not 0
 		 */
 		if (!nr_running && idle_cpu(i)) {
 			sgs->idle_cpus++;
-			/* Idle cpu can't have misfit task */
+			/*
+			 * Idle cpu can neither be overutilized nor have a
+			 * misfit task.
+			 */
 			continue;
 		}
 
+		if (cpu_overutilized(i))
+			*sg_status |= SG_OVERUTILIZED;
+
 		if (local_group)
 			continue;
 
-- 
2.25.1


  parent reply	other threads:[~2021-12-20 11:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 11:43 [PATCH 0/3] Fix stuck overutilized Vincent Donnefort
2021-12-20 11:43 ` [PATCH 1/3] sched/fair: Make cpu_overutilized() EAS dependent Vincent Donnefort
2021-12-20 17:17   ` Valentin Schneider
2021-12-21  9:09     ` Vincent Donnefort
2021-12-20 11:43 ` [PATCH 2/3] sched/fair: Fix newidle_balance() for overutilized systems Vincent Donnefort
2021-12-20 17:17   ` Valentin Schneider
2021-12-22  8:14   ` Vincent Guittot
2022-01-10 16:29     ` Vincent Donnefort
2021-12-20 11:43 ` Vincent Donnefort [this message]
2021-12-20 17:17   ` [PATCH 3/3] sched/fair: Do not raise overutilized for idle CPUs Valentin Schneider
2021-12-22  8:20   ` Vincent Guittot
2022-01-10 16:40     ` Vincent Donnefort
2022-01-17 10:45       ` Vincent Guittot
2022-01-17 12:18         ` Vincent Donnefort

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=20211220114323.22811-4-vincent.donnefort@arm.com \
    --to=vincent.donnefort@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).