Re: [PATCH] tools/sched_ext: use btf_vlen() helper in compat.h

From: luoliang

Date: Tue Jun 30 2026 - 04:17:05 EST


From: Liang Luo <luoliang@xxxxxxxxxx>

On Tue, Jun 30, 2026 at 07:13:51AM +0200, Andrea Righi wrote:
> btf_vlen() currently returns __u32, not __u16. This changed in commit
> cacd6729c0923 ("libbpf: Adjust btf_vlen() to return a __u32"), because BTF vlen
> was expanded to 24 bits. We should update the description to match this. And i
> should be changed to __u32 for consistency.
>
> With these changes:
>
> Reviewed-by: Andrea Righi <arighi@xxxxxxxxxx>

Thanks Andrea, and thanks to Sashiko for catching this first. You're
both right, and I apologize for the noise on the list.

I made a basic mistake: I developed and verified v1 against a v7.1
baseline, where btf_vlen() still returns __u16 and the warning does
go away there. But I did not re-check against current mainline,
which is what the patch actually targets. On mainline, cacd6729c0923
already widened btf_vlen() to __u32 (the BTF vlen field itself was
expanded from 16 to 24 bits), so on mainline v1 does not silence the
warning, and the commit message's core claim is false there. Sashiko
flagged the return-type discrepancy, and Andrea identified both the
root cause and the fix (declare the loop counters as __u32). I
should have caught this myself before sending.

v2 incoming, rebased on v7.2-rc1, with the description corrected and
the two loop counters declared as __u32 so the comparison is a plain
'__u32 < __u32'. Verified on v7.2-rc1 that all -Wsign-compare
instances from compat.h are gone across the 8 userspace schedulers,
with no new warnings introduced.

Sorry again for the extra review cycles, and thanks for the careful
reviews.

Thanks,
Liang