Re: [PATCH 3/6] sched_ext: Introduce per-node idle cpumasks
From: Tejun Heo
Date: Wed Dec 18 2024 - 11:10:32 EST
Hello,
On Wed, Dec 18, 2024 at 11:21:30AM +0100, Andrea Righi wrote:
...
> > Are node IDs guaranteed to be consecutive? Shouldn't it be `node >=
> > nr_node_ids`? Also, should probably add node_possible(node)?
>
> Or even better add node_online(node), an offline NUMA node shouldn't be
> used in this context.
That can be too but then we'd have to worry about synchronizing against
going on/offline. Looks like that's protected by mem_hotplug_lock, so we'd
have to require get_online_mems() around these iterations, which might not
be worth it. Besides, if we want to triger abort on incorrect input, we'd
have to call sched_ext ops under mem_hotplug_lock, which we probably can't
do.
...
> > Is rcu_read_lock() necessary? Does lockdep warn if the explicit
> > rcu_read_lock() is dropped?
>
> Good point, the other for_each_numa_hop_mask() iterator requires it, but
> only to access the cpumasks via rcu_dereference(). Since we are iterating
> node IDs I think we can get rid of rcu_read_lock/unlock() here. I'll double
> check if lockdep complains without it.
Yeah, this function should always be called with preemption disabled, so
even if rcu_read_lock() is required, it should already be implied by the
context.
Thanks.
--
tejun