page_cgroup_ino(9)
π page_cgroup_ino β Kernel API Manual
Okay bestie, welcome to the page_cgroup_ino(9) page from the Kernel API Manual β¨ this one's short and sweet but it's got lore, so stay with me.
πΈ NAME
page_cgroup_ino β returns the inode number of the memcg that a page is charged to π
β¨ SYNOPSIS
ino_t page_cgroup_ino (struct page *page );
π ARGUMENTS
pageβ the page. that's it. that's the argument. the page in question π
π¦ DESCRIPTION
So what this does: it goes and finds the closest online ancestor of the memory cgroup that page is charged to, and hands you back that cgroup's inode number. And if page isn't charged to any cgroup at all? You get 0. no inode, no problem π«Ά
The actually iconic part: it is totally safe to call this function without holding a reference to page. go off, no refcount needed.
β οΈ ok but here's the catch and I need you to hear me on this one β this function is inherently racy. there is literally nothing stopping the cgroup inode from getting torn down and potentially reallocated a moment after page_cgroup_ino returns. like, a moment. so only call it if you genuinely do not care (procfs interfaces, for example β they're built different π).
π SEE ALSO
The kernel file ./mm/memcontrol.c, plus the whole friend group π:
get_mem_cgroup_css_from_folio(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(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)
<div>and that's the whole vibe check bestie π§ this page came straight out of ./mm and it's dated October 2026 β periodt, go read memcontrol.c now, iykyk π</div>
π¦ 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