mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Mihail Mihov <mihovmihailp@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: <mingo@kernel.org>, <longman@redhat.com>,
	<chenridong@huaweicloud.com>, <juri.lelli@redhat.com>,
	<vincent.guittot@linaro.org>, <dietmar.eggemann@arm.com>,
	<rostedt@goodmis.org>, <bsegall@google.com>, <mgorman@suse.de>,
	<vschneid@redhat.com>, <tj@kernel.org>, <hannes@cmpxchg.org>,
	<mkoutny@suse.com>, <cgroups@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <jstultz@google.com>,
	<qyousef@layalina.io>, <regressions@lists.linux.dev>
Subject: Re: [REGRESSION] core scheduling latency with idle load
Date: Tue, 17 Nov 2026 15:52:15 +0530	[thread overview]
Message-ID: <add0d6ee-c28d-4274-b8d1-58638abac47a@amd.com> (raw)
In-Reply-To: <avt_mdiPQ5gwAisa@lima-fedora>

Hello Mihail,

On 11/17/2026 3:52 AM, Mihail Mihov wrote:
> On Fri, Jun 05, 2026 at 02:40:20PM +0200, Peter Zijlstra wrote:
>> @@ -14893,30 +14803,8 @@ bool cfs_prio_less(const struct task_str
> [...]
>> -     se_fi_update(sea, rq->core->core_forceidle_seq, in_fi);
>> -     se_fi_update(seb, rq->core->core_forceidle_seq, in_fi);
> 
> In case it helps: adding these two calls back on v7.3.4 brought the
> cookie p99 back to 55 us.

I can confirm I see skipped cfs_rq->zero_vruntime_fi updates for root from
cfs_prio_less() which would have previously bumped up the zero_vruntime_fi
at common ancestor.

> I don't know whether that is the right thing
> to do, only that it changes this result.

It might be since cfs_prio_less() would have compared the zero_vruntime_fi
at common ancestor but now, everything is driven at root cfs_rq.

That said, perhaps se_fi_update() could itself be optimized now with
flattened pick. Could you try below changes a try:

  (Prepared on top of v7.4-rc3; Lightly tested)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0c8af1cac2d5..3935693bdf2f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -15278,30 +15278,21 @@ static inline void task_tick_core(struct rq *rq, struct task_struct *curr)
 /*
  * se_fi_update - Update the cfs_rq->zero_vruntime_fi in a CFS hierarchy if needed.
  */
-static void se_fi_update(const struct sched_entity *se, unsigned int fi_seq,
-			 bool forceidle)
+static void cfs_rq_fi_update(struct cfs_rq *cfs_rq, unsigned int fi_seq, bool forceidle)
 {
-	for_each_sched_entity(se) {
-		struct cfs_rq *cfs_rq = cfs_rq_of(se);
-
-		if (forceidle) {
-			if (cfs_rq->forceidle_seq == fi_seq)
-				break;
-			cfs_rq->forceidle_seq = fi_seq;
-		}
+	if (forceidle && cfs_rq->forceidle_seq == fi_seq)
+		return;
 
-		cfs_rq->zero_vruntime_fi = cfs_rq->zero_vruntime;
-	}
+	cfs_rq->forceidle_seq = fi_seq;
+	cfs_rq->zero_vruntime_fi = cfs_rq->zero_vruntime;
 }
 
 void task_vruntime_update(struct rq *rq, struct task_struct *p, bool in_fi)
 {
-	struct sched_entity *se = &p->se;
-
 	if (p->sched_class != &fair_sched_class)
 		return;
 
-	se_fi_update(se, rq->core->core_forceidle_seq, in_fi);
+	cfs_rq_fi_update(&rq->cfs, rq->core->core_forceidle_seq, in_fi);
 }
 
 bool cfs_prio_less(const struct task_struct *a, const struct task_struct *b,
@@ -15319,6 +15310,9 @@ bool cfs_prio_less(const struct task_struct *a, const struct task_struct *b,
 	cfs_rqa = &task_rq(a)->cfs;
 	cfs_rqb = &task_rq(b)->cfs;
 
+	cfs_rq_fi_update(cfs_rqa, rq->core->core_forceidle_seq, in_fi);
+	cfs_rq_fi_update(cfs_rqb, rq->core->core_forceidle_seq, in_fi);
+
 	/*
 	 * Find delta after normalizing se's vruntime with its cfs_rq's
 	 * zero_vruntime_fi, which would have been updated in prior calls
-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-11-17 10:22 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05 12:40 [PATCH v3 0/7] sched: Flatten the pick Peter Zijlstra
2026-06-05 12:40 ` [PATCH v3 1/7] sched/fair: Add cgroup_mode switch Peter Zijlstra
2026-06-30  9:03   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-06-05 12:40 ` [PATCH v3 2/7] sched/fair: Add cgroup_mode: up Peter Zijlstra
2026-06-05 15:07   ` Peter Zijlstra
2026-06-30  9:03   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-06-05 12:40 ` [PATCH v3 3/7] sched/fair: Add cgroup_mode: max Peter Zijlstra
2026-06-10 15:09   ` Waiman Long
2026-06-10 15:42     ` Waiman Long
2026-06-11 13:49       ` Peter Zijlstra
2026-06-11 13:47     ` Peter Zijlstra
2026-06-11 20:57       ` Waiman Long
2026-06-30  9:03   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-06-05 12:40 ` [PATCH v3 4/7] sched/fair: Add cgroup_mode: concur Peter Zijlstra
2026-06-30  9:03   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-06-05 12:40 ` [PATCH v3 5/7] sched/fair: Add cgroup_mode: tasks Peter Zijlstra
2026-06-30  9:03   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-06-05 12:40 ` [PATCH v3 6/7] sched/fair: Change the default cgroup_mode to concur Peter Zijlstra
2026-06-30  9:03   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2026-06-05 12:40 ` [PATCH v3 7/7] sched/eevdf: Move to a single runqueue Peter Zijlstra
2026-06-20  3:54   ` Chen, Yu C
2026-06-26 11:40     ` Peter Zijlstra
2026-06-29 14:02       ` Vincent Guittot
2026-06-30  9:03     ` [tip: sched/core] sched/fair: Fix overflow in update_tg_cfs_runnable() tip-bot2 for Chen, Yu C
2026-06-30  9:03   ` [tip: sched/core] sched/eevdf: Move to a single runqueue tip-bot2 for Peter Zijlstra (Intel)
2026-09-23 14:21   ` [REGRESSION] [PATCH v3 7/7] " Aishwarya Rambhadran
2026-09-23 16:48     ` Chen Yu
2026-09-24  7:05       ` K Prateek Nayak
2026-09-24  8:19       ` Mike Galbraith
2026-09-28  3:12         ` Chen Yu
2026-09-28 13:00           ` Mike Galbraith
2026-10-07 12:05             ` Aishwarya Rambhadran
2026-10-12 11:27               ` Mike Galbraith
2026-10-16 13:18   ` Jakub Okoński
2026-10-18  6:49     ` Mike Galbraith
2026-10-19 17:01       ` Vincent Guittot
2026-10-19 17:35         ` Jakub Okoński
2026-10-19 18:04           ` Vincent Guittot
2026-10-19 18:24             ` Jakub Okoński
2026-10-19 18:26               ` Vincent Guittot
2026-10-21 11:55                 ` Vincent Guittot
2026-10-22 12:05                   ` Jakub Okoński
2026-10-30 15:48       ` Chengfeng Lin
2026-10-22  2:12     ` Mike Galbraith
2026-11-16 22:22   ` [REGRESSION] core scheduling latency with idle load Mihail Mihov
2026-11-17 10:22     ` K Prateek Nayak [this message]
2026-11-17 11:11       ` Mihail Mihov
2026-06-09  5:37 ` [PATCH v3 0/7] sched: Flatten the pick K Prateek Nayak
2026-06-12  2:29 ` Shubhang Kaushik
2026-08-17 16:05 ` Szabina Korbai
2026-08-17 16:35   ` K Prateek Nayak
2026-08-18  9:04     ` Szabina Korbai
2026-08-18  9:16       ` Peter Zijlstra
2026-08-21 10:37         ` Szabina Korbai
2026-08-24 14:51         ` Chen Yu
2026-08-24 13:53           ` Peter Zijlstra

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=add0d6ee-c28d-4274-b8d1-58638abac47a@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huaweicloud.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mihovmihailp@gmail.com \
    --cc=mingo@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=regressions@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.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®