mem_cgroup_migrate(9)
π
mem_cgroup_migrate β the mem_cgroup_migrate(9) glow-up
okay so bestie, this is a page from the kernel API manual, section 9, and it's literally about moving memcg data from one folio to another. short page, but every word ate. let's get into it π«Ά
β¨ NAME β¨
mem_cgroup_migrate β transfer the memcg data from the old folio to the new folio. that's the whole vibe. moving the data, not copying it, not duplicating it, transferring it. π
πΈ SYNOPSIS πΈ
void mem_cgroup_migrate (struct folio *old , struct folio *new );
that's it. that's the signature. two folios, no notes, no cap. returns void so don't go looking for an error code, it's not giving that today. β
π ARGUMENTS π
oldβ the folio that's currently circulating, aka the one being replaced. it's the outgoing main character, handing over the crown. πnewβ the replacement folio. it's stepping in, taking the memcg data, and honestly? slay. π¦
π DESCRIPTION π
okay so here's the actual tea. mem_cgroup_migrate transfers the memcg data from the old folio over to the new folio, and it does this for migration β like, this is the handoff moment. π§
and listen, the old folio's data info will be cleared. gone. wiped. it's giving "your data lives in the new folio now, bestie." not me being dramatic, that's just literally what the manpage says.
the memory counters remain unchanged, unless the charge moves out of a fully reparented ancestry and has to be settled (see below). π
β οΈ real talk, bestie: both folios must be locked, and new->mapping must be set up. not set up = not slaying. this is a hard requirement, no vibes-based workarounds. π
π¦ SEE ALSO π¦
kernel file ./mm/memcontrol.c, plus the whole friend group of related calls β every single one, because we don't do "etc." in this house:
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_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_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)
all of these are linked, all of these are iconic, iykyk. π₯
π one last thing π
this page lives in ./mm, and it was dated October 2026 β yes, the future, she's ahead of her time π. that's mem_cgroup_migrate(9), manual section 9, kernel API manual. mwah. π
π¦ 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