Re: [PATCH 1/6] sched/topology: introduce for_each_numa_hop_node() / sched_numa_hop_node()

From: Andrea Righi
Date: Thu Dec 19 2024 - 16:20:43 EST


On Thu, Dec 19, 2024 at 08:52:30PM +0100, Peter Zijlstra wrote:
> On Thu, Dec 19, 2024 at 10:26:59AM -0800, Yury Norov wrote:
> > > Given that there usually aren't that many nodes, the current implementation
> > > is probably fine too, so please feel free to ignore this suggestion for now
> > > too.
> >
> > I agree. The number of nodes on typical system is 1 or 2. Even if
> > it's 8, the Andrea's bubble sort will be still acceptable. So, I'm
> > OK with O(N^2) if you guys OK with it. I only would like to have
> > this choice explained in commit message.
>
> There are systems with 100s or 1000s of nodes out there. As long as
> hitting this code path is optional I suppose that's not a problem, but
> if not, they're going to be rather upset.

Right, this code is optional, it's only hit when SCX_OPS_KEEP_BUILTIN_IDLE
is enabled (off by default) in an scx scheduler and the scheduler is asking
for any idle CPU in the system without speficying a target node.

So, it shouldn't be a big concern for now, and we can probably add
optimizations for special cases later. I'll add a comment to explain this
as well.

Thanks,
-Andrea