linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Use __counted_by for ancestor arrays
@ 2025-12-17 16:27 Michal Koutný
  2025-12-17 16:27 ` [PATCH 2/4] cgroup: Introduce cgroup_level() helper Michal Koutný
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Koutný @ 2025-12-17 16:27 UTC (permalink / raw)
  To: linux-block, bpf, linux-trace-kernel, netfilter-devel, netdev,
	coreteam, linux-hardening, linux-kernel, cgroups
  Cc: Michal Koutný, Hao Luo, Mathieu Desnoyers,
	Alexei Starovoitov, Phil Sutter, Yonghong Song, Jens Axboe,
	Jozsef Kadlecsik, Steven Rostedt, Martin KaFai Lau, KP Singh,
	Eric Dumazet, Florian Westphal, Jiri Olsa, Stanislav Fomichev,
	Song Liu, David S. Miller, Simon Horman, John Fastabend,
	Johannes Weiner, Daniel Borkmann, Andrii Nakryiko, Tejun Heo,
	Josef Bacik, Paolo Abeni, Gustavo A. R. Silva, Pablo Neira Ayuso,
	Eduard Zingerman, Yu Kuai, Masami Hiramatsu, Kees Cook,
	Jakub Kicinski

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-12-20 21:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-17 16:27 [PATCH 0/4] Use __counted_by for ancestor arrays Michal Koutný
2025-12-17 16:27 ` [PATCH 2/4] cgroup: Introduce cgroup_level() helper Michal Koutný
2025-12-17 16:46   ` bot+bpf-ci
2025-12-20 14:59   ` kernel test robot
2025-12-20 21:49   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).