lruvec_page_state_monotonic(9)
π lruvec_page_state_monotonic(9) β Kernel API Manual π
Okay bestie, this is the manual page for lruvec_page_state_monotonic(9) β manual name folded in right at the top, we're so back. It's the non-clamping lruvec stat read for delta sampling. Slay. β¨
πΈ NAME πΈ
lruvec_page_state_monotonic β non-clamping lruvec stat read for delta sampling.
β¨ SYNOPSIS β¨
unsigned long lruvec_page_state_monotonic (struct lruvec *lruvec , enum
node_stat_item idx );
π ARGUMENTS π
lruvecβ the LRU vector to read from. That's the source, bestie.idxβ thenode_stat_itemto read. The exact stat you're pulling up.
π¦ DESCRIPTION π¦
So this function returns the raw state[idx] value cast to unsigned long, and the whole glow-up is that it skips the clamp-negative-to-zero step that lives in lruvec_page_state. No cap.
It's intended for callers that snapshot a monotonically-incremented counter and then subtract two samples. With unsigned modular arithmetic, that subtraction yields the correct delta across a signed-long wraparound β which is a real hazard on 32-bit β and that wraparound would otherwise be turned into a huge spurious delta by the clamp. Literally iconic behavior. π
Do NOT use this for non-monotonic page-count reads where a transient negative reading from per-CPU delta skew must present as zero. That is not the moment, bestie. π
XXX: This helper (and its node/global peers) exists because some monotonically-incremented event counters are stored in enum node_stat_item. That's the tea. π΅
π SEE ALSO π
Kernel file ./mm/memcontrol.c plus this whole referenced crew:
get_mem_cgroup_css_from_folio(9)page_cgroup_ino(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)
Source/version: ./mm Β· Date: October 2026 Β· lruvec_page_state_monotonic(9) β bye bestie, go snapshot those counters and stay monotonic πβ¨
π¦ 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