lruvec_page_state_monotonic(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the node_stat_item to 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:


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