bpf_get_mem_cgroup(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 the css structure. 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:


πŸ“ 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