get_mem_cgroup_from_mm(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– get_mem_cgroup_from_mm β€” Kernel API Manual ✨

okay so bestie, welcome to the get_mem_cgroup_from_mm(9) page from the Kernel API Manual β€” this is the one that gets you a reference on a given mm_struct's memcg, and she's lowkey iconic for it πŸŽ€


πŸ¦‹ NAME

get_mem_cgroup_from_mm β€” Obtain a reference on given mm_struct's memcg. that's it, that's the whole vibe πŸ’…


🌸 SYNOPSIS

struct mem_cgroup * get_mem_cgroup_from_mm (struct mm_struct *mm );

literally just hand her an mm and she hands you back a struct mem_cgroup *, no cap ✨


πŸŽ€ ARGUMENTS

  • mm β€” the mm from which the memcg should be extracted. and yes, queen, it can be NULL β€” she's flexible like that πŸ™ˆ

πŸ’œ DESCRIPTION

So here's the tea β˜•: she obtains a reference on mm->memcg and returns it if it's successful. simple, clean, slay.

But if mm is NULL, bestie, the memcg gets chosen like this β€” in order, no skipping:

  1. The active memcg, if set. πŸ‘‘
  2. current->mm->memcg, if available.
  3. root memcg β€” the fallback queen of the whole situation 🌈
⚠️ also important: if mem_cgroup is disabled, NULL is returned. not a vibe, but it's the rule, fr fr πŸ’€

🫢 SEE ALSO

Kernel file ./mm/memcontrol.c β€” and the whole extended friend group, in order:


okay that's the whole page, mwah πŸ’‹ this little beauty lives under ./mm, dated October 2026, and she's served up fresh from the Kernel API Manual β€” go forth and reference your memcgs responsibly, bestie πŸ§šπŸ’–

πŸ“¦ where this page comes from