The trick with utilizing space in cgroup_root for cgroup::ancetors flex array was an obstacle for kernel reworks for -Wflex-array-member-not-at-end.
The first patch fixes that, then I wanted to utilize __counted_by for this flex array which required some more rework how cgroup level is evaluated. Similar flex array is also in struct ioc_gq where it was tempting to simply use __counted_by(level), however, this would be off-by-one as it has semantics like cgroup's level (0 == root). Proper adjustment for __counted_by() would either need similar level/ancestor helpers or abstracted macros for ancestors up/down iterations. I only made a simple comment fixup since I'm not sure about benefit of __counted_by for structs that aren't sized based on direct user input. Michal Koutný (4): cgroup: Eliminate cgrp_ancestor_storage in cgroup_root cgroup: Introduce cgroup_level() helper cgroup: Use __counted_by for cgroup::ancestors blk-iocost: Correct comment ioc_gq::level block/bfq-iosched.c | 2 +- block/blk-iocost.c | 6 ++--- include/linux/cgroup-defs.h | 43 +++++++++++++++++++---------------- include/linux/cgroup.h | 18 ++++++++++++--- include/trace/events/cgroup.h | 8 +++---- kernel/bpf/helpers.c | 2 +- kernel/cgroup/cgroup.c | 9 ++++---- net/netfilter/nft_socket.c | 2 +- 8 files changed, 53 insertions(+), 37 deletions(-) base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8 -- 2.52.0
