mem_cgroup_charge(9)
π mem_cgroup_charge(9) π
π NAME π
mem_cgroup_charge β Charge a newly allocated folio to a cgroup. This is the Kernel API Manual page, and bestie, itβs literally about charging a newly allocated folio to a cgroup. Main character energy, honestly. π«Ά
β¨ SYNOPSIS β¨
okay hereβs the exact signature, no cap:
int mem_cgroup_charge (struct folio *folio , struct mm_struct *mm ,
gfp_t gfp );
π¦ ARGUMENTS π¦
folioβ the folio to charge. πmmβ the mm context of the allocating task. π§gfpβ reclaim mode. π₯
πΈ DESCRIPTION πΈ
So the vibe is: try to charge folio to the memcg that mm belongs to, reclaiming pages according to gfp if necessary. β¨ If mm is NULL, try to charge to the active memcg. π«Ά
β οΈ Do not use this for folios allocated for swapin. Not me warning you dramatically, but this is a hard no β fr fr. π
π RETURN π
0 on success. Otherwise, an error code is returned. Thatβs the whole tea, periodt. π
π SEE ALSO π
Iβm highkey obsessed with these references, iykyk:
- Kernel file
./include/linux/memcontrol.h mem_cgroup_shrink_is_root(9)mem_cgroup_uncharge(9)mem_cgroup_lruvec(9)folio_lruvec(9)parent_mem_cgroup(9)
Signed off from ./include/linux, dated October 2026, on the mem_cgroup_charge(9) page β slay and stay charged π
πβ¨
π¦ 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