pcpu_map_pages(9)
π
pcpu_map_pages β okay so this is a <rainbow>kernel API manual</rainbow> page, bestie
Hi hi! Welcome to the pcpu_map_pages(9) page β yes, the (9) means it's a kernel API section, iykyk. This is the one that maps pages into a pcpu_chunk, and honestly it's giving lowkey essential. Let's go π«Ά
β¨ NAME β¨
pcpu_map_pages β map pages into a pcpu_chunk π¦
β¨ SYNOPSIS β¨
int pcpu_map_pages (struct pcpu_chunk *chunk , struct page **pages , int
page_start , int page_end , gfp_t gfp );
That's the whole signature, fr fr β copy it exactly, don't be editing it π
β¨ ARGUMENTS β¨
chunkβ the chunk of interest π like, the one we're actually doing stuff topagesβ the pages array, and it contains all the pages you wanna mappage_startβ page index of the first page to map πΈpage_endβ page index of the last page to map + 1 β (yes, plus one β it's exclusive at the top end, don't forget the+ 1bestie)gfpβ allocation flags, passed straight down to the underlying allocator π
β¨ DESCRIPTION β¨
So for each cpu, this maps the pages in the range [page_start,page_end) into chunk. Slay. π₯
Heads up: the caller is responsible for calling pcpu_post_map_flush after all the mappings are complete. Not before, not halfway through β after they're all done. That's on you, not on this function π
This function is also the one responsible for setting up whatever is necessary for reverse lookup (addr -> chunk). So it's out here doing the behind-the-scenes main character work π
β¨ SEE ALSO β¨
Go read these too, bestie β they're all canon π
- Kernel file
./mm/percpu-vm.c pcpu_get_pages(9)pcpu_free_pages(9)pcpu_alloc_pages(9)pcpu_pre_unmap_flush(9)pcpu_unmap_pages(9)pcpu_post_unmap_tlb_flush(9)pcpu_post_map_flush(9)pcpu_populate_chunk(9)pcpu_depopulate_chunk(9)pcpu_should_reclaim_chunk(9)
Anyways, that's the page! π§ For the record, the source directory is ./mm and this one's dated October 2026 β so yeah, it's timestamped from the future-ish, we love that for us ππ Byeee, go map some pages responsibly! π
π¦ 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