page_pool_fragment_page(9)
π page_pool_fragment_page β kernel API manual, bestie edition π
okay so this whole page lives in the kernel API manual (that's the page_pool_fragment_page(9) situation, iykyk) and it's literally about splitting a fresh page into fragments. it's short, it's sweet, it's kind of a baddie. let's get into it π
β¨ NAME β¨
page_pool_fragment_page β split a fresh page into fragments π¦
πΈ SYNOPSIS πΈ
void page_pool_fragment_page (struct page *page , long nr );
π ARGUMENTS π
pageβ the page you're splitting, bestie. that's the one.nrβ the number of references to set. like, how many you're claiming upfront.
π DESCRIPTION π
so pp_ref_count is the number of outstanding references to the page, and those references get freed using page_pool APIs β not the page allocator APIs like put_page. important distinction, no cap. these references are usually held by page_pool-aware objects, like skbs that are marked for page pool recycling. π§
this helper lets the caller take (set) multiple references to a freshly allocated page. and the page must be freshly allocated β meaning it has a pp_ref_count of 1. that part is not optional, so don't come at it with a used page, bestie π
drivers and "fragment allocators" commonly do this to save atomic operations. it's giving efficiency queen. they do it either when they know upfront how many references they'll need, or when they take MAX references and return the unused ones with a single atomic dec instead of doing multiple atomic inc operations. one and done. slay. β
π SEE ALSO π
- kernel file
./include/net/page_pool/helpers.h page_pool allocator(9)page_pool_dev_alloc_pages(9)page_pool_dev_alloc_frag(9)page_pool_dev_alloc(9)page_pool_dev_alloc_va(9)page_pool_get_dma_dir(9)page_pool_put_page(9)page_pool_put_full_page(9)page_pool_recycle_direct(9)page_pool_free_va(9)page_pool_get_dma_addr(9)page_pool_dma_sync_for_cpu(9)page_pool_is_unreadable(9)
π«Ά and that's the whole vibe! this one came from ./include/net/page_pool and it's dated October 2026 β so like, from the future, main character energy fr fr. go forth and fragment 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