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: <20241014083608.GU17263@noisy.programming.kicks-ass.net>
Date: Mon, 14 Oct 2024 10:36:08 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Andrea Righi <andrea.righi@...ux.dev>
Cc: Tejun Heo <tj@...nel.org>, David Vernet <void@...ifault.com>,
	Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
	Valentin Schneider <vschneid@...hat.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched_ext: Always call put_prev_task() with scx enabled

On Sun, Oct 13, 2024 at 07:39:28PM +0200, Andrea Righi wrote:
> With the consolidation of put_prev_task/set_next_task(), we are now
> skipping the sched_ext ops.stopping/running() transitions when the
> previous and next tasks are the same, see commit 436f3eed5c69 ("sched:
> Combine the last put_prev_task() and the first set_next_task()").
> 
> While this optimization makes sense in general, it can negatively impact
> performance in some user-space schedulers, that expect to handle such
> transitions when tasks exhaust their timeslice (see SCX_OPS_ENQ_LAST).
> 
> For example, scx_rustland suffers a significant performance regression
> (e.g., gaming benchmarks drop from ~60fps to ~10fps).
> 
> To fix this, ensure that put_prev_task()/set_next_task() are never
> skipped when the scx scheduling class is enabled, allowing the scx class
> to handle such transitions.
> 
> This change restores the previous behavior, fixing the performance
> regression in scx_rustland.
> 
> Link: https://github.com/sched-ext/scx/issues/788

How persistent are links like that? In general I strongly discourage
links to things not pointing to kernel.org resources.

> @@ -2523,6 +2508,21 @@ DECLARE_STATIC_KEY_FALSE(__scx_switched_all);	/* all fair class tasks on SCX */
>  #define scx_switched_all()	false
>  #endif /* !CONFIG_SCHED_CLASS_EXT */
>  
> +static inline void put_prev_set_next_task(struct rq *rq,
> +					  struct task_struct *prev,
> +					  struct task_struct *next)
> +{
> +	WARN_ON_ONCE(rq->curr != prev);
> +
> +	__put_prev_set_next_dl_server(rq, prev, next);
> +
> +	if (next == prev && !scx_enabled())
> +		return;

Does that not also want to include a 'next->sched_class ==
&ext_sched_class' clause ? And a comment?

> +
> +	prev->sched_class->put_prev_task(rq, prev, next);
> +	next->sched_class->set_next_task(rq, next, true);
> +}

And is there really no way scx can infer this happened? We just did pick
after all, that can see this coming a mile of.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ