page_counter_set_max(9)
π 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 actualstruct page_counterthing 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:
page_counter_cancel(9)page_counter_charge(9)page_counter_try_charge(9)page_counter_uncharge(9)page_counter_set_min(9)page_counter_set_low(9)page_counter_memparse(9)page_counter_calculate_protection(9)
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
- 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