mem_cgroup_charge(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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:


Signed off from ./include/linux, dated October 2026, on the mem_cgroup_charge(9) page β€” slay and stay charged πŸ’…πŸŽ€βœ¨

πŸ“¦ where this page comes from