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: <Z7JCeiLpxoZB7rnl@gpd3>
Date: Sun, 16 Feb 2025 20:54:34 +0100
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
	Yury Norov <yury.norov@...il.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>,
	Joel Fernandes <joel@...lfernandes.org>, Ian May <ianm@...dia.com>,
	bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 8/8] sched_ext: idle: Introduce node-aware idle cpu kfunc
 helpers

On Sun, Feb 16, 2025 at 06:57:03AM -1000, Tejun Heo wrote:
> Hello,
> 
> On Fri, Feb 14, 2025 at 08:40:07PM +0100, Andrea Righi wrote:
> ...
> >  const struct cpumask *scx_bpf_get_idle_cpumask_node(int node)
> >  const struct cpumask *scx_bpf_get_idle_smtmask_node(int node)
> >  s32 scx_bpf_pick_idle_cpu_in_node(const cpumask_t *cpus_allowed,
> >  				   int node, u64 flags)
> 
> All other functions have just _node as the suffix. Might as well do the same
> here?

I agree, I'll rename this scx_bpf_pick_idle_cpu_node().

> 
> >  s32 scx_bpf_pick_any_cpu_node(const cpumask_t *cpus_allowed,
> >  			       int node, u64 flags)
> 
> ...
> > +__bpf_kfunc const struct cpumask *scx_bpf_get_idle_cpumask_node(int node)
> > +{
> > +	node = validate_node(node);
> > +	if (node < 0)
> > +		return cpu_none_mask;
> > +
> > +#ifdef CONFIG_SMP
> > +	return idle_cpumask(node)->cpu;
> > +#else
> > +	return cpu_none_mask;
> 
> Shouldn't the UP case forwarded to scx_bpf_get_idle_cpumask()? Wouldn't a
> NUMA aware scheduler running on a UP kernel end up specifying 0 to these
> calls?

Hm... but scx_bpf_get_idle_cpumask() also returns cpu_none_mask in the UP
case. We also want to validate the node and trigger a failure if an invalid
node is specified (and in the UP case, node 0 is valid, since
nr_node_ids == 1).

> 
> > +__bpf_kfunc const struct cpumask *scx_bpf_get_idle_smtmask_node(int node)
> > +{
> > +	node = validate_node(node);
> > +	if (node < 0)
> > +		return cpu_none_mask;
> > +
> > +#ifdef CONFIG_SMP
> > +	if (sched_smt_active())
> > +		return idle_cpumask(node)->smt;
> > +	else
> > +		return idle_cpumask(node)->cpu;
> > +#else
> > +	return cpu_none_mask;
> 
> Ditto here.
> 
> Thanks.
> 
> -- 
> tejun

-Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ