mem_cgroup_update_lru_size(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mem_cgroup_update_lru_size(9) ✨

okay so bestie, welcome to the Kernel API Manual β€” yes we're in the kernel API manual today, hold my iced coffee πŸ§ŠπŸ’– β€” and today's main character is mem_cgroup_update_lru_size. she's a little function with a big job and honestly? she ate. let's get into it πŸŽ€


🌸 NAME 🌸

mem_cgroup_update_lru_size β€” account for adding or removing an lru page πŸ’«

like, literally her whole thing is keeping the books for lru pages going in and out. no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

void mem_cgroup_update_lru_size (struct lruvec *lruvec , enum lru_list
lru , int zid , long nr_pages );

that's the whole signature, bestie β€” copy it exactly, don't be out here freehanding it πŸ™ˆ


✨ ARGUMENTS ✨

  • lruvec β€” the mem_cgroup per zone lru vector πŸ’œ this is where the accounting lives.
  • lru β€” the index of the lru list the page is sitting on πŸ›‹οΈ like which couch is the page chilling on.
  • zid β€” the zone id of the accounted pages πŸ—ΊοΈ
  • nr_pages β€” positive when adding or negative when removing πŸ”₯ yes she's signed, that's the whole vibe check. plus = coming in, minus = leaving.

πŸ‘‘ DESCRIPTION πŸ‘‘

This function must be called under lru_lock β€” not optional, not "if u feel like it", this is a hard requirement bestie πŸ’€

Timing is literally the entire plot: call it just before a page is added to an lru list, or just after a page is removed from an lru list. not during, not whenever, not "approximately" β€” before and after. periodt 🫢

⚠️ lowkey important: skip the lru_lock and you're not slaying, you're just wrong. the manpage says must, and must means must 😭

🌈 SEE ALSO 🌈

Kernel file ./mm/memcontrol.c β€” and honestly she has SO many mutuals, look at this friend group πŸ’… all of these are (9) pages, iykyk:


and that's the page bestie!! πŸŒΈπŸ¦‹ she's from the kernel source tree at ./mm, and this edition is dated October 2026 β€” mwah, go forth and lock your lru's πŸ’–πŸŽ€πŸ‘‘

πŸ“¦ where this page comes from