[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z7NxboD4_G7HVAlf@gpd3>
Date: Mon, 17 Feb 2025 18:27:10 +0100
From: Andrea Righi <arighi@...dia.com>
To: Yury Norov <yury.norov@...il.com>
Cc: Tejun Heo <tj@...nel.org>, 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>,
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 Mon, Feb 17, 2025 at 12:24:19PM -0500, Yury Norov wrote:
> On Mon, Feb 17, 2025 at 02:41:27PM +0100, Andrea Righi wrote:
> > On Fri, Feb 14, 2025 at 04:28:57PM -0500, Yury Norov wrote:
> > > On Fri, Feb 14, 2025 at 08:40:07PM +0100, Andrea Righi wrote:
> > ...
> > > > +/**
> > > > + * scx_bpf_get_idle_cpumask_node - Get a referenced kptr to the
> > > > + * idle-tracking per-CPU cpumask of a target NUMA node.
> > > > + *
> > > > + * Returns an empty cpumask if idle tracking is not enabled, if @node is
> > > > + * not valid, or running on a UP kernel. In this case the actual error will
> > > > + * be reported to the BPF scheduler via scx_ops_error().
> > > > + */
> > > > +__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;
> > > > +#endif
> > >
> > > Here you need to check for SMP at the beginning. That way you can
> > > avoid calling validate_node() if SMP is disabled.
> >
> > As mentioned in the other email, I'm not sure if we want to skip
> > validate_node() in the UP case.
> >
> > I guess the question is: should we completely ignore the node argument,
> > since it doesn't make sense in the UP case, or should we still validate it,
> > given that node == 0 is still valid in this scenario?
>
> Ok, I see. You don't promote the error from validate_node(), but you
> print something inside.
Right, it calls scx_ops_error() inside, that prints the error and also
forces the active BPF scheduler to exit (it's like an exception for the BPF
scheduler basically).
-Andrea
Powered by blists - more mailing lists