mem_cgroup_update_lru_size(9)
π 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:
get_mem_cgroup_css_from_folio(9)page_cgroup_ino(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_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)
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
- 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