mem_cgroup_iter(9)
π 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'sNULLon first invocation. first time? no notes. πreclaimβ the cookie for shared reclaim walks, orNULLfor 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:
get_mem_cgroup_css_from_folio(9)page_cgroup_ino(9)lruvec_page_state_monotonic(9)mod_memcg_state(9)mod_lruvec_state(9)count_memcg_events(9)get_mem_cgroup_from_mm(9)get_mem_cgroup_from_current(9)get_mem_cgroup_from_folio(9)mem_cgroup_iter_break(9)mem_cgroup_scan_tasks(9)folio_lruvec_lock(9)folio_lruvec_lock_irq(9)folio_lruvec_lock_irqsave(9)mem_cgroup_update_lru_size(9)mem_cgroup_margin(9)mem_cgroup_print_oom_context(9)mem_cgroup_print_oom_meminfo(9)mem_cgroup_get_oom_group(9)consume_stock(9)__memcg_kmem_charge_page(9)__memcg_kmem_uncharge_page(9)mem_cgroup_wb_stats(9)mem_cgroup_from_private_id(9)mem_cgroup_css_reset(9)mem_cgroup_calculate_protection(9)mem_cgroup_charge_hugetlb(9)mem_cgroup_swapin_charge_folio(9)mem_cgroup_replace_folio(9)mem_cgroup_migrate(9)mem_cgroup_sk_charge(9)mem_cgroup_sk_uncharge(9)__mem_cgroup_try_charge_swap(9)__mem_cgroup_uncharge_swap(9)obj_cgroup_may_zswap(9)obj_cgroup_charge_zswap(9)obj_cgroup_uncharge_zswap(9)
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
- 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