public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Fernand Sieber <sieberf@amazon.com>
To: <peterz@infradead.org>
Cc: <bsegall@google.com>, <dietmar.eggemann@arm.com>,
	<graf@amazon.com>, <juri.lelli@redhat.com>,
	<linux-kernel@vger.kernel.org>, <mingo@redhat.com>,
	<sieberf@amazon.com>, <tanghui20@huawei.com>,
	<vincent.guittot@linaro.org>, <vineethr@linux.ibm.com>,
	<wangtao554@huawei.com>, <zhangqiao22@huawei.com>
Subject: Re: [PATCH RESEND] sched/fair: Only increment deadline once on yield
Date: Tue, 16 Sep 2025 15:35:20 +0200	[thread overview]
Message-ID: <20250916133520.406318-1-sieberf@amazon.com> (raw)
In-Reply-To: <20250911113746.GO4067720@noisy.programming.kicks-ass.net>

On Thu, Sep 11, 2025 at 01:37:46PM +0200, Peter Zijlstra wrote:
> Have you tried:
>
>       se->vruntime = se->deadline;
>       se->deadline += calc_delta_fair(se->slice, se);
>
> instead?

Thanks, that is better, see results below.
Forfeiting the vruntime allows competing tasks to make more progress.
Both approaches eliminate the problematic run delays.
I'll send out an updated version of the patch.

Repro:
taskset -c 1 yield_loop &
taskset -c 1 stress --cpu 1 --timeout 30s &

With yield loop:
int main() {
    time_t start = time(NULL);
    while (time(NULL) - start < 5) {
        sched_yield();
    }
    while (1) {}
    return 0;
}

Results (perf sched latency):
vanilla:
  stress:      2368ms runtime, max delay 25268ms (!)
  yield_loop: 27637ms runtime, max delay 2ms

deadline clamping:
  stress:      4629ms runtime, max delay 2ms
  yield_loop:  4632ms runtime, max delay 2ms

vruntime forfeiting:
  stress:      7117ms runtime, max delay 2ms
  yield_loop:  2144ms runtime, max delay 2ms



Amazon Development Centre (South Africa) (Proprietary) Limited
29 Gogosoa Street, Observatory, Cape Town, Western Cape, 7925, South Africa
Registration Number: 2004 / 034463 / 07


  parent reply	other threads:[~2025-09-16 13:35 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 [this message]
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
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=20250916133520.406318-1-sieberf@amazon.com \
    --to=sieberf@amazon.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=graf@amazon.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --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