pcpu_alloc_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

pcpu_alloc_pages β€” okay so this one literally allocates pages for @chunk, bestie ✨

Also hi, welcome to the Kernel API Manual πŸŽ€ this is the group chat for kernel devs, and this function is the main character today.


✨ SYNOPSIS ✨

int pcpu_alloc_pages (struct pcpu_chunk *chunk , struct page **pages ,
int page_start , int page_end , gfp_t gfp );

That's the whole vibe check right there πŸ‘‘ five arguments, one int back. Slay.


🌸 ARGUMENTS 🌸

  • chunk β€” the target chunk 🎯 like, this is the chunk we're doing all this for, she's the moment.
  • pages β€” an array where the allocated pages get dropped into, indexed by pcpu_page_idx πŸ“₯ so whichever page lands at a given index, that's where it goes. No cap.
  • page_start β€” page index of the first page to be allocated 🏁 the starting line, fr fr.
  • page_end β€” page index of the last page to be allocated + 1 πŸ™ˆ yep, plus one, it's exclusive, that's just how she is.
  • gfp β€” allocation flags that get passed straight to the underlying allocator 🧚 lowkey important, these flags decide how the allocation behaves.

πŸ¦‹ DESCRIPTION πŸ¦‹

So what she does: allocate the pages in the range [page_start,page_end) into pages, for all units πŸ’… that half-open interval is doing a lot of work, so respect it.

The allocation is for chunk β€” that's her chunk, that's the whole point, don't forget it.

And here's the cute part: the percpu core genuinely does not care about the content of pages 😌 she's unbothered, she's chill, she will pass it verbatim to pcpu_map_pages. Not edited, not touched up, verbatim. Periodt. πŸ’œ


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./mm/percpu-vm.c β€” go read the source, iykyk πŸ“– and also these icons:


ok that's the whole page bestie, every flag, every arg, nothing skipped πŸ’€ go forth and allocate responsibly 🫢

mwah πŸ’‹ this came from ./mm, dated October 2026, and it's pcpu_alloc_pages(9) β€” catch you in the next manpage, love u, bye! πŸŽ€βœ¨

πŸ“¦ where this page comes from