mem_cgroup_iter(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay bestie, this is mem_cgroup_iter from the Kernel API Manual (yes, the mem_cgroup_iter(9) girlies know) β€” it's the function that lets you iterate over the memory cgroup hierarchy. slay. 🌸


✨ SYNOPSIS ✨

struct mem_cgroup * mem_cgroup_iter (struct mem_cgroup *root , struct
mem_cgroup *prev , struct mem_cgroup_reclaim_cookie *reclaim );

πŸŽ€ ARGUMENTS πŸŽ€

  • root β€” the hierarchy root, aka where the walk starts. main character energy.
  • prev β€” the previously returned memcg, and it's NULL on first invocation. first time? no notes. πŸ’…
  • reclaim β€” the cookie for shared reclaim walks, or NULL for full walks. choose your fighter.

πŸ¦‹ DESCRIPTION πŸ¦‹

It returns references to children of the hierarchy below root, or root itself, or NULL after a full round-trip. like it literally hands you the whole tour and then a little NULL at the end to say "that's the whole loop, periodt." 🫢

The caller must pass the return value in prev on subsequent invocations for reference counting, or use mem_cgroup_iter_break to cancel a hierarchy walk before the round-trip is complete. no skipping the reference counting, bestie, that's the whole vibe. 😭

Reclaimers can specify a node in reclaim to divide up the memcgs in the hierarchy among all concurrent reclaimers operating on the same node. it's giving "share the aux cord at the function" ngl. 🎧


🌈 SEE ALSO 🌈

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


that's the whole page, babes β€” sourced from ./mm, dated October 2026, and proudly titled mem_cgroup_iter(9). go forth and iterate responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from