Re: [PATCH sched_ext/for-7.4] sched_ext: cid: Represent clusters explicitly

From: Tejun Heo

Date: Sat Sep 26 2026 - 15:23:38 EST


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.

> + 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?

Thanks.

--
tejun