Re: [PATCH 8/8] sched_ext: idle: Introduce node-aware idle cpu kfunc helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux