mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srikar Dronamraju <srikar@linux.ibm.com>
To: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Srikar Dronamraju <srikar@linux.ibm.com>
Subject: [PATCH 1/3] sched/fair: Exclude delayed-dequeued tasks from sum_nr_running
Date: Fri, 20 Nov 2026 07:19:48 +0530	[thread overview]
Message-ID: <20261120014946.1355234-6-srikar@linux.ibm.com> (raw)
In-Reply-To: <20261120014946.1355234-5-srikar@linux.ibm.com>

Delayed dequeue keeps a sleeping task on the CFS runqueue until its
accumulated lag is repaid. While such tasks remain accounted in
rq->nr_running, they are no longer runnable and are not eligible to
consume CPU time.

update_sg_lb_stats() currently uses rq->nr_running when computing
sum_nr_running. As a result, delayed-dequeued tasks contribute to group
load statistics even though they are effectively sleeping. This can
inflate the apparent load of a group and influence load balancing
decisions.

Other metrics collected by update_sg_lb_stats(), such as group_runnable
and h_nr_runnable, already focus on runnable work. Counting delayed
entities in sum_nr_running makes it inconsistent with the rest of the
load-balancing statistics.

Exclude cfs_h_nr_delayed() tasks from sum_nr_running so that load
balancing decisions are based on runnable tasks rather than entities
waiting to complete delayed dequeue accounting.

Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d4cc0caee626..21f2b17894e3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12296,7 +12296,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
 		sgs->group_runnable += cpu_runnable(rq);
 		sgs->sum_h_nr_running += rq->cfs.h_nr_runnable;
 
-		nr_running = rq->nr_running;
+		nr_running = rq->nr_running - cfs_h_nr_delayed(rq);
 		sgs->sum_nr_running += nr_running;
 
 		if (cpu_overutilized(i))
-- 
2.55.0


  reply	other threads:[~2026-11-20  1:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  1:49 [PATCH 0/3] sched: Fix load accounting and improve imbalance calculation Srikar Dronamraju
2026-11-20  1:49 ` Srikar Dronamraju [this message]
2026-11-20  1:49 ` [PATCH 2/3] sched/fair: Use runnable task imbalance for asymmetric groups Srikar Dronamraju
2026-11-20  1:49 ` [PATCH 3/3] sched/topology: Simplify cache_nice_tries initialization Srikar Dronamraju

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=20261120014946.1355234-6-srikar@linux.ibm.com \
    --to=srikar@linux.ibm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /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

all inboxes | Powered by JetHome®