mirror-linux/kernel/cgroup
Michal Koutný ef56578274 cgroup: Eliminate cgrp_ancestor_storage in cgroup_root
The cgrp_ancestor_storage has two drawbacks:
- it's not guaranteed that the member immediately follows struct cgrp in
  cgroup_root (root cgroup's ancestors[0] might thus point to a padding
  and not in cgrp_ancestor_storage proper),
- this idiom raises warnings with -Wflex-array-member-not-at-end.

Instead of relying on the auxiliary member in cgroup_root, define the
0-th level ancestor inside struct cgroup (needed for static allocation
of cgrp_dfl_root), deeper cgroups would allocate flexible
_low_ancestors[].  Unionized alias through ancestors[] will
transparently join the two ranges.

The above change would still leave the flexible array at the end of
struct cgroup inside cgroup_root, so move cgrp also towards the end of
cgroup_root to resolve the -Wflex-array-member-not-at-end.

Link: https://lore.kernel.org/r/5fb74444-2fbb-476e-b1bf-3f3e279d0ced@embeddedor.com/
Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Closes: https://lore.kernel.org/r/b3eb050d-9451-4b60-b06c-ace7dab57497@embeddedor.com/
Cc: David Laight <david.laight.linux@gmail.com>
Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2026-01-07 15:11:03 -10:00
..
Makefile kernel/cgroup: Add "dmem" memory accounting cgroup 2025-01-06 17:24:38 +01:00
cgroup-internal.h cgroup: replace global percpu_rwsem with per threadgroup resem when writing to cgroup.procs 2025-09-10 07:44:51 -10:00
cgroup-v1.c cgroup: replace global percpu_rwsem with per threadgroup resem when writing to cgroup.procs 2025-09-10 07:44:51 -10:00
cgroup.c cgroup: Eliminate cgrp_ancestor_storage in cgroup_root 2026-01-07 15:11:03 -10:00
cpuset-internal.h cpuset: remove global remote_children list 2025-11-11 11:47:08 -10:00
cpuset-v1.c cpuset: add helpers for cpus read and cpuset_mutex locks 2025-08-25 08:20:22 -10:00
cpuset.c cpuset: fix warning when disabling remote partition 2025-12-18 06:38:54 -10:00
debug.c cgroup: Remove redundant rcu_read_lock/unlock() in spin_lock 2025-09-16 08:36:14 -10:00
dmem.c rculist: move list_for_each_rcu() to where it belongs 2025-08-25 10:13:26 -07:00
freezer.c cgroup: cgroup.stat.local time accounting 2025-08-22 07:50:43 -10:00
legacy_freezer.c freezer: Clarify that only cgroup1 freezer uses PM freezer 2025-10-30 20:10:27 +01:00
misc.c Merge branch 'kvm-tdx-initial' into HEAD 2025-04-07 07:36:33 -04:00
namespace.c cgroup: add cgroup namespace to tree after owner is set 2025-10-31 10:16:24 +01:00
pids.c cgroup/pids: Remove unreachable paths of pids_{can,cancel}_fork 2024-08-05 10:32:16 -10:00
rdma.c rdmacg: fix kernel-doc warnings in rdmacg 2023-06-05 09:45:14 -10:00
rstat.c cgroup: rstat: use LOCK CMPXCHG in css_rstat_updated 2025-12-08 08:26:56 -10:00