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] [day] [month] [year] [list]
Message-ID: <Z4GA7mUGNDoAZbMc@gpd3>
Date: Fri, 10 Jan 2025 21:19:58 +0100
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
	Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	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 v6] sched_ext: idle: Refresh idle masks during
 idle-to-idle transitions

On Fri, Jan 10, 2025 at 09:39:09AM -1000, Tejun Heo wrote:
> Hello, Andrea.
> 
> On Fri, Jan 10, 2025 at 09:46:25AM +0100, Andrea Righi wrote:
> ...
> > +	if (do_notify) {
> > +		if (SCX_HAS_OP(update_idle) && !scx_rq_bypassing(rq))
> > +			SCX_CALL_OP(SCX_KF_REST, update_idle, cpu_of(rq), idle);
> > +	} else {
> > +		bool is_prev_idle;
> > +
> > +		/* Refresh idle masks during idle-to-idle transitions */
> 
> Can you add a bit more explanation on what case this path is handling here
> or in the function comment? The function comment explains what it's about
> but doesn't quite explain the exact sequence which isn't very intuitive.

Ok.

> 
> > +		rcu_read_lock();
> > +		is_prev_idle = is_idle_task(rcu_dereference(rq->curr));
> > +		rcu_read_unlock();
> > +
> > +		if (!is_prev_idle)
> >  			return;
> 
> This function is always called under the rq lock, right? We can assert that
> and skip the rcu dancing.

Yes, good point!

> 
> >  	}
> >  
> > +	if (!static_branch_likely(&scx_builtin_idle_enabled))
> > +		return;
> 
> Would structure like the following be better? It makes clear that the last
> condition checks are for the builtin idle path.
> 
>         if (SCX_HAS_OP(update_idle) && do_notify && !scx_rq_bypassing(rq))
>                 // call ops.update_idle().
> 
>         if (!scx_builtin_idle_enabled || (!do_notify && !is_idle_task(rq->curr)))
>                 return;

It's also more compact, I like it.

I'll apply these changes and rephrase the comments to better clarify the
logic of the different code paths.

Thanks,
-Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ