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: <20250911113746.GO4067720@noisy.programming.kicks-ass.net>
Date: Thu, 11 Sep 2025 13:37:46 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Fernand Sieber <sieberf@...zon.com>
Cc: mingo@...hat.com, vincent.guittot@...aro.org, juri.lelli@...hat.com,
	dietmar.eggemann@....com, bsegall@...gle.com, graf@...zon.com,
	wangtao554@...wei.com, tanghui20@...wei.com, zhangqiao22@...wei.com,
	linux-kernel@...r.kernel.org, nh-open-source@...zon.com,
	Madadi Vineeth Reddy <vineethr@...ux.ibm.com>
Subject: Re: [PATCH RESEND] sched/fair: Only increment deadline once on yield

On Thu, Sep 11, 2025 at 11:51:13AM +0200, Fernand Sieber 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 updating the deadline only to one slice ahead.
> 
> Note, we might want to consider iterating on the implementation of yield as
> follow up:
> * the yielding task could be forfeiting its remaining slice by
>   incrementing its vruntime correspondingly

This..

> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index b173a059315c..d6a0d22d08d7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8921,7 +8921,7 @@ static void yield_task_fair(struct rq *rq)
>  	 */
>  	rq_clock_skip_update(rq);
> 
> -	se->deadline += calc_delta_fair(se->slice, se);
> +	se->deadline = se->vruntime + calc_delta_fair(se->slice, se);

Have you tried:

	se->vruntime = se->deadline;
	se->deadline += calc_delta_fair(se->slice, se);

instead?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ