public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Fernand Sieber <sieberf@amazon.com>
Cc: bsegall@google.com, dietmar.eggemann@arm.com, dwmw@amazon.co.uk,
	graf@amazon.com, jschoenh@amazon.de, juri.lelli@redhat.com,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	tanghui20@huawei.com, vincent.guittot@linaro.org,
	vineethr@linux.ibm.com, wangtao554@huawei.com,
	zhangqiao22@huawei.com
Subject: Re: [PATCH v2] sched/fair: Forfeit vruntime on yield
Date: Thu, 18 Sep 2025 12:21:59 +0200	[thread overview]
Message-ID: <20250918102159.GH1386988@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250918064300.GV3419281@noisy.programming.kicks-ass.net>

On Thu, Sep 18, 2025 at 08:43:00AM +0200, Peter Zijlstra wrote:
> On Tue, Sep 16, 2025 at 06:00:35PM +0200, Fernand Sieber wrote:
> > After further testing I think we should stick with the original approach or
> > iterate on the vruntime forfeiting.
> > 
> > The vruntime forfeiting doesn't work well with core scheduling. The core
> > scheduler picks the best task across the SMT mask, and then the siblings run a
> > matching task no matter what. This means the core scheduler can keep picking
> > the yielding task on the sibling even after it becomes ineligible (because it's
> > preferrable than force idle). In this scenario the vruntime of the yielding
> > task runs away rapidly, which causes problematic imbalances later on.
> > 
> > Perhaps an alternative is to forfeit the vruntime (set it to the deadline), but
> > only once. I.e don't do it if the task is already ineligible? If the task is
> > ineligible then we simply increment the deadline as in my original patch?
> > 
> > Peter, let me know your thoughts on this.
> 
> Sorry, I missed this email earlier. I'll go ponder it a bit -- my brain
> is esp. slow today due to a cold :/

Right; so you're saying something like the below, right?

Yeah, I suppose we can do that; please write a coherent comment on it
though, so we can remember why, later on.

---
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 5c94caa93085..e75abf3c256d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9012,8 +9012,13 @@ static void yield_task_fair(struct rq *rq)
 	 */
 	rq_clock_skip_update(rq);
 
-	se->vruntime = se->deadline;
-	se->deadline += calc_delta_fair(se->slice, se);
+	/*
+	 * comment...
+	 */
+	if (entity_eligible(cfs_rq, se)) {
+		se->vruntime = se->deadline;
+		se->deadline += calc_delta_fair(se->slice, se);
+	}
 }
 
 static bool yield_to_task_fair(struct rq *rq, struct task_struct *p)

  reply	other threads:[~2025-09-18 10:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11  9:51 [PATCH RESEND] sched/fair: Only increment deadline once on yield Fernand Sieber
2025-09-11 11:03 ` Alexander Graf
2025-09-11 11:37 ` Peter Zijlstra
2025-09-11 13:56   ` Peter Zijlstra
2025-09-16 13:35   ` Fernand Sieber
2025-09-16 14:02 ` [PATCH v2] sched/fair: Forfeit vruntime " Fernand Sieber
2025-09-16 16:00   ` Fernand Sieber
2025-09-18  6:43     ` Peter Zijlstra
2025-09-18 10:21       ` Peter Zijlstra [this message]
2025-09-18 15:05         ` [PATCH v3] " Fernand Sieber
2025-09-24  8:25           ` kernel test robot
2025-09-26  4:56           ` kernel test robot
2025-10-16  9:33           ` [tip: sched/core] " tip-bot2 for Fernand Sieber
2025-11-05  9:13           ` [PATCH v4] " Fernand Sieber
2025-09-17 19:22   ` [PATCH v2] " Fernand Sieber
2025-09-18  2:45   ` Xuewen Yan

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=20250918102159.GH1386988@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=dwmw@amazon.co.uk \
    --cc=graf@amazon.com \
    --cc=jschoenh@amazon.de \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sieberf@amazon.com \
    --cc=tanghui20@huawei.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vineethr@linux.ibm.com \
    --cc=wangtao554@huawei.com \
    --cc=zhangqiao22@huawei.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