lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB8ipk-zK+T+8NTnQzYex+CFpA3vaeLuPLJ_vyJpKi4MSem+rA@mail.gmail.com>
Date: Thu, 18 Sep 2025 10:45:00 +0800
From: Xuewen Yan <xuewen.yan94@...il.com>
To: Fernand Sieber <sieberf@...zon.com>
Cc: peterz@...radead.org, mingo@...hat.com, vincent.guittot@...aro.org, 
	juri.lelli@...hat.com, dietmar.eggemann@....com, bsegall@...gle.com, 
	graf@...zon.com, jschoenh@...zon.de, dwmw@...zon.co.uk, wangtao554@...wei.com, 
	tanghui20@...wei.com, zhangqiao22@...wei.com, linux-kernel@...r.kernel.org, 
	vineethr@...ux.ibm.com, Xuewen Yan <xuewen.yan@...soc.com>
Subject: Re: [PATCH v2] sched/fair: Forfeit vruntime on yield

On Tue, Sep 16, 2025 at 10:33 PM Fernand Sieber <sieberf@...zon.com> wrote:
>
> If a task yields, the scheduler may decide to pick it again. The task in
> turn may decide to yield immediately or shortly after, leading to a tight
> loop of yields.
>
> If there's another runnable task as this point, the deadline will be
> increased by the slice at each loop. This can cause the deadline to runaway
> pretty quickly, and subsequent elevated run delays later on as the task
> doesn't get picked again. The reason the scheduler can pick the same task
> again and again despite its deadline increasing is because it may be the
> only eligible task at that point.
>
> Fix this by making the task forfeiting its remaining vruntime and pushing
> the deadline one slice ahead. This implements yield behavior more
> authentically.
>
> Fixes: 147f3efaa24182 ("sched/fair: Implement an EEVDF-like scheduling  policy")
> Link: https://lore.kernel.org/r/20250401123622.584018-1-sieberf@amazon.com
> Link: https://lore.kernel.org/r/20250911095113.203439-1-sieberf@amazon.com
> Signed-off-by: Fernand Sieber <sieberf@...zon.com>
>
> Changes in v2:
> - Implement vruntime forfeiting approach suggested by Peter Zijlstra
> - Updated commit name
> - Previous Reviewed-by tags removed due to algorithm change
> ---
>  kernel/sched/fair.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 7a14da5396fb..cc4ef7213d43 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9036,6 +9036,7 @@ 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);

Need we update_min_vruntime here?

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ