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