summaryrefslogtreecommitdiff
path: root/include/linux/assoc_array.h
diff options
context:
space:
mode:
authorRoman Gushchin <roman.gushchin@linux.dev>2025-12-22 20:41:53 -0800
committerAlexei Starovoitov <ast@kernel.org>2025-12-22 22:20:21 -0800
commit5c7db3239c9fbe3c62cb0d89b64959ea23af2de9 (patch)
treea2bff5530dfeef1d9795ce009f42c84d4ab42172 /include/linux/assoc_array.h
parent5904db9891f80f84283648121e2d8c8a506296a8 (diff)
mm: introduce bpf_get_root_mem_cgroup() BPF kfunc
Introduce a BPF kfunc to get a trusted pointer to the root memory cgroup. It's very handy to traverse the full memcg tree, e.g. for handling a system-wide OOM. It's possible to obtain this pointer by traversing the memcg tree up from any known memcg, but it's sub-optimal and makes BPF programs more complex and less efficient. bpf_get_root_mem_cgroup() has a KF_ACQUIRE | KF_RET_NULL semantics, however in reality it's not necessary to bump the corresponding reference counter - root memory cgroup is immortal, reference counting is skipped, see css_get(). Once set, root_mem_cgroup is always a valid memcg pointer. It's safe to call bpf_put_mem_cgroup() for the pointer obtained with bpf_get_root_mem_cgroup(), it's effectively a no-op. Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev> Link: https://lore.kernel.org/r/20251223044156.208250-4-roman.gushchin@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux/assoc_array.h')
0 files changed, 0 insertions, 0 deletions