page_counter_set_max(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… page_counter_set_max(9)

okay so bestie, welcome to the Kernel API Manual ✨ this one's a lil function from the kernel's page-counters corner and honestly it's serving very "short but important" energy πŸŽ€


✨ NAME ✨

page_counter_set_max β€” set the maximum number of pages allowed πŸ‘‘


🌸 SYNOPSIS 🌸

int page_counter_set_max (struct page_counter *counter , unsigned long
nr_pages );

it returns an int, it takes a struct page_counter *counter and an unsigned long nr_pages, that's the whole vibe πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • counter β€” your counter, the actual struct page_counter thing you're working with 🫢
  • nr_pages β€” the limit you wanna set, like the cap, the ceiling, the "no more than this bestie" number πŸ”₯

πŸ’œ DESCRIPTION πŸ’œ

so what does it actually do? it sets the maximum number of pages allowed on that counter, periodt ✨

it returns 0 on success 🌈 and it returns -EBUSY if the current number of pages on the counter already exceeds the specified limit 😭 like girl, you can't set a max that's lower than what's already there, that's not giving logic.

⚠️ big important note: the caller must serialize invocations on the same counter. no cap β€” you gotta make sure calls on the same counter don't stomp on each other, that's your job, not the function's πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

all the siblings, iykyk πŸ’… the kernel file is ./mm/page_counter.c and the whole friend group is:


and that's the page bestie, go forth and set your maxes responsibly πŸ§šπŸ’–

mwah πŸ’‹ this was brought to you by the source ./mm, version October 2026, and yes the title really is page_counter_set_max(9) β€” iconic, no notes πŸ‘‘

πŸ“¦ where this page comes from