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: <aOYLfSfePpgL4gMQ@gpd4>
Date: Wed, 8 Oct 2025 08:58:05 +0200
From: Andrea Righi <arighi@...dia.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: tj@...nel.org, linux-kernel@...r.kernel.org, mingo@...nel.org,
	juri.lelli@...hat.com, vincent.guittot@...aro.org,
	dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
	mgorman@...e.de, vschneid@...hat.com, longman@...hat.com,
	hannes@...xchg.org, mkoutny@...e.com, void@...ifault.com,
	changwoo@...lia.com, cgroups@...r.kernel.org,
	sched-ext@...ts.linux.dev, liuwenfang@...or.com, tglx@...utronix.de
Subject: Re: [PATCH 01/12] sched: Employ sched_change guards

Hi Peter,

On Wed, Oct 08, 2025 at 08:51:03AM +0200, Peter Zijlstra wrote:
> On Tue, Oct 07, 2025 at 10:20:44AM +0200, Andrea Righi wrote:
> > Hi Peter,
> > 
> > On Mon, Oct 06, 2025 at 12:44:03PM +0200, Peter Zijlstra wrote:
> > > As proposed a long while ago -- and half done by scx -- wrap the
> > > scheduler's 'change' pattern in a guard helper.
> > > 
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > > Acked-by: Tejun Heo <tj@...nel.org>
> > > ---
> > ...
> > > --- a/kernel/sched/sched.h
> > > +++ b/kernel/sched/sched.h
> > > @@ -3885,23 +3885,22 @@ extern void check_class_changed(struct r
> > >  extern struct balance_callback *splice_balance_callbacks(struct rq *rq);
> > >  extern void balance_callbacks(struct rq *rq, struct balance_callback *head);
> > >  
> > > -#ifdef CONFIG_SCHED_CLASS_EXT
> > > -/*
> > > - * Used by SCX in the enable/disable paths to move tasks between sched_classes
> > > - * and establish invariants.
> > > - */
> > > -struct sched_enq_and_set_ctx {
> > 
> > Not necessarily for this patch, we can add it later, but I kinda liked the
> > comment that briefly explained how the context is used. Maybe having
> > something along these lines could be helpful?
> 
> I have changed it thus:
> 
> 
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -3885,6 +3885,22 @@ extern void check_class_changed(struct r
>  extern struct balance_callback *splice_balance_callbacks(struct rq *rq);
>  extern void balance_callbacks(struct rq *rq, struct balance_callback *head);
>  
> +/*
> + * The 'sched_change' pattern is the safe, easy and slow way of changing a
> + * task's scheduling properties. It dequeues a task, such that the scheduler
> + * is fully unaware of it; at which point its properties can be modified;
> + * after which it is enqueued again.
> + *
> + * Typically this must be called while holding task_rq_lock, since most/all
> + * properties are serialized under those locks. There is currently one
> + * exception to this rule in sched/ext which only holds rq->lock.
> + */
> +
> +/*
> + * This structure is a temporary, used to preserve/convey the queueing state
> + * of the task between sched_change_begin() and sched_change_end(). Ensuring
> + * the task's queueing state is idempotent across the operation.
> + */

Looks great and very clear, thanks!

-Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ