bpf_get_mem_cgroup(9)
β¨ bpf_get_mem_cgroup(9) β¨
okay bestie, welcome to the Kernel API Manual entry for bpf_get_mem_cgroup β yes that's the manual name, yes we're citing our sources, we're nothing if not academic here π
π NAME π
bpf_get_mem_cgroup β grab a reference to a memory cgroup, no cap
πΈ SYNOPSIS πΈ
__bpf_kfunc struct mem_cgroup * bpf_get_mem_cgroup (struct
cgroup_subsys_state *css );
π¦ ARGUMENTS π¦
cssβ pointer to thecssstructure. that's it, that's the whole argument, she's low maintenance π
β DESCRIPTION β
so here's the vibe check: it's totally fine to pass a css that belongs to any cgroup controller β like, for example, the unified hierarchy's main css. literally any controller, she does not gatekeep π«Ά
It implements KF_ACQUIRE semantics. iconic behavior, honestly π
π RETURN π
A pointer to a mem_cgroup structure β and this is the important part, bestie β after bumping the corresponding css's reference counter. so like, the refcount went up, that's the whole point of the function, we love a queen who knows her purpose β¨
π SEE ALSO π
Kernel file ./mm/bpf_memcontrol.c β and her whole friend group:
bpf_get_root_mem_cgroup(9)bpf_put_mem_cgroup(9)bpf_mem_cgroup_vm_events(9)bpf_mem_cgroup_usage(9)bpf_mem_cgroup_memory_events(9)bpf_mem_cgroup_page_state(9)bpf_mem_cgroup_flush_stats(9)
π reminder bestie: this is an acquire situation, so there's a matching bpf_put_mem_cgroup(9) waiting for you at the end of the night. don't leave her hanging π
and that's the page!! sourced straight from ./mm, dated October 2026 β mwah, go read the other bpf memcg ones, ily, bye π§ββοΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms