pcpu_alloc_pages(9)
π 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 bypcpu_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:
pcpu_get_pages(9)pcpu_free_pages(9)pcpu_pre_unmap_flush(9)pcpu_unmap_pages(9)pcpu_post_unmap_tlb_flush(9)pcpu_map_pages(9)pcpu_post_map_flush(9)pcpu_populate_chunk(9)pcpu_depopulate_chunk(9)pcpu_should_reclaim_chunk(9)
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
- 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