cgroup: Replace cgroup->ancestor_ids[] with ->ancestors[]
authorTejun Heo <tj@kernel.org>
Fri, 29 Jul 2022 23:10:16 +0000 (13:10 -1000)
committerTejun Heo <tj@kernel.org>
Mon, 15 Aug 2022 21:16:47 +0000 (11:16 -1000)
commit7f203bc89eb66d6afde7eae91347fc0352090cc3
treea8a4f1fa1203a0200089982587709f334b0ff968
parent568035b01cfb107af8d2e4bd2fb9aea22cf5b868
cgroup: Replace cgroup->ancestor_ids[] with ->ancestors[]

Every cgroup knows all its ancestors through its ->ancestor_ids[]. There's
no advantage to remembering the IDs instead of the pointers directly and
this makes the array useless for finding an actual ancestor cgroup forcing
cgroup_ancestor() to iteratively walk up the hierarchy instead. Let's
replace cgroup->ancestor_ids[] with ->ancestors[] and remove the walking-up
from cgroup_ancestor().

While at it, improve comments around cgroup_root->cgrp_ancestor_storage.

This patch shouldn't cause user-visible behavior differences.

v2: Update cgroup_ancestor() to use ->ancestors[].

v3: cgroup_root->cgrp_ancestor_storage's type is updated to match
    cgroup->ancestors[]. Better comments.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
include/linux/cgroup-defs.h
include/linux/cgroup.h
kernel/cgroup/cgroup.c
net/netfilter/nft_socket.c
tools/perf/util/bpf_skel/bperf_cgroup.bpf.c