mod_lruvec_state(9)
π mod_lruvec_state β kernel API manual, section 9, bestie edition π
okay so real talk: this one lives in the Kernel API Manual, section 9, and it's the lil function that keeps your lruvec memory stats from lying to you. no cap, it's giving "quietly holding the whole memory accounting system together" energy. π
β¨ NAME β¨
mod_lruvec_state β update lruvec memory statistics πΈ
β¨ SYNOPSIS β¨
void mod_lruvec_state (struct lruvec *lruvec , enum node_stat_item idx ,
int val );
like literally that's the whole signature, she's not complicated π
β¨ ARGUMENTS β¨
lruvecβ the lruvec itself. yes, THE lruvec. the whole point. π«Άidxβ the stat item you're clocking. which counter are we vibing with today? βvalβ the delta you're adding to the counter. and yes bestie, it can be negative β we go both ways here, increments and decrements, no judgement π
β¨ DESCRIPTION β¨
so quick lore drop π§: the lruvec is the intersection of the NUMA node and a cgroup. like that's the exact meeting point of those two things, that's her whole identity.
what mod_lruvec_state does is update all three counters that get affected when the state changes at this level:
- per-node
- per-cgroup
- per-lruvec
three counters, one call, she ate and left no crumbs π₯ the way that one function keeps all three in sync so nothing drifts... iconic behaviour honestly π
β¨ SEE ALSO β¨
Kernel file ./mm/memcontrol.c β and like, the entire extended friend group π:
get_mem_cgroup_css_from_folio(9)page_cgroup_ino(9)lruvec_page_state_monotonic(9)mod_memcg_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)
that's a whole group chat right there, go say hi to all of them π¦
and that's the page!! π this one's sourced from ./mm, dated October 2026, and it's mod_lruvec_state(9) β mwah, go update those stats responsibly bestie π
π
π¦ 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