Re: [PATCH sched_ext/for-7.4] sched_ext: cid: Represent clusters explicitly
From: Andrea Righi
Date: Sat Sep 26 2026 - 15:58:54 EST
Hi Tejun,
On Sat, Sep 26, 2026 at 09:23:15AM -1000, Tejun Heo wrote:
> Hello, Andrea.
>
> On Sat, Sep 26, 2026 at 05:23:06PM +0200, Andrea Righi wrote:
> > - set @cluster_cid to the LLC's own CID when no cluster level exists,
> > - set @cluster_idx to -1 when no cluster level exists,
>
> The other levels are inclusive: a level that doesn't exist for a cpu is
> represented by the level below it, the way a core on a non-SMT machine is
> just the cpu. Can we do the same here? A core without a cluster level is
> its own cluster, cluster_cid = core_cid with a dense cluster_idx. Then
> every cluster is a contiguous cid range, cluster_idx indexes per-cluster
> arrays without a -1 special case, and cluster_cid can't alias between a
> real cluster and the fallback cpus in the same LLC.
Makes sense, I'll change the fallback so each such core is its own cluster with
cluster_cid = core_cid and a dense cluster_idx.
>
> > + s32 cluster_cid;
> > + s32 cluster_idx;
>
> Growing struct scx_cid_topo breaks existing binaries: scx_bpf_cid_topo()
> copies out the kernel's sizeof into a buffer the program sized from its
> own vmlinux.h. I'm changing the kfunc to take the buffer size and copy the
> smaller of the two, filling the rest with -1, and routing that through
> for-7.3-fixes so that it lands before any growth. Can you base the next
> version on top of it and append the new fields at the end of the struct?
Yes, I'll send a new version on top of your fix (already reviewed) and keep the
new fields at the end.
There's also a comment from Sashiko about dropping __uninit, but it looks like a
false positive to me, the current verifier checks the out buffer for read access
even with that suffix, so restoring it would not change whether an uninitialized
stack buffer is accepted.
Thanks,
-Andrea