consume_stock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay bestie, welcome to consume_stock(9) from the Kernel API Manual ✨ its whole thing is: try to consume stocked charge on this cpu. no cap.

🌸 SYNOPSIS 🌸

bool consume_stock (struct mem_cgroup *memcg , unsigned int nr_pages );

πŸŽ€ ARGUMENTS πŸŽ€

  • memcg β€” the memcg to consume from. literally the one you're pulling from πŸ’…
  • nr_pages β€” how many pages to charge. the page count, bestie.

πŸ¦‹ DESCRIPTION πŸ¦‹

so consume_stock() consumes the cached charge if enough nr_pages are present; otherwise it returns failure 😭. it also returns failure if the charge request is larger than MEMCG_CHARGE_BATCH, or if the local lock is already taken. yes, that's a real failure case, not a drill πŸ’€

and it returns true if successful, false otherwise. periodt. πŸ‘‘

✨ SEE ALSO ✨

Kernel file ./mm/memcontrol.c is the main spot, and the whole friend group is:

bye bestie πŸ’… this one comes from ./mm, dated October 2026, and it's consume_stock(9) 🫢

πŸ“¦ where this page comes from