page_pool_put_page(9)
β¨ page_pool_put_page β¨
okay so bestie, welcome to the page_pool_put_page page from the Kernel API Manual π«Ά this is the one where you hand a page back to the pool and let it decide what happens next. no cap, the outcome is genuinely not up to you.
πΈ SYNOPSIS πΈ
void page_pool_put_page (struct page_pool *pool , struct page *page ,
unsigned int dma_sync_size , bool allow_direct );
that's the whole signature, slay. four arguments, zero drama (well, some drama β keep reading π ).
π ARGUMENTS π
poolβ the pool your page came from in the first place. don't be out here returning pages to random pools, that's not the vibe πpageβ the actual page you're dropping a reference on. the main character of this whole operation β¨dma_sync_sizeβ how much of the page the device may have touched. literally, how much. you don't get to just say "some of it" πallow_directβ set this when the release is coming from the consumer and you want to allow lockless caching. key detail, iykyk π₯
π¦ DESCRIPTION π¦
okay so here's the tea β β what actually happens here depends entirely on the page refcnt, and there are three separate timelines:
- if the driver bumps the refcnt > 1 β this will unmap the page. that's it, that's the outcome π
- if the page refcnt is 1 β the allocator owns the page, and it will try to recycle it in one of the pool caches. iconic behavior, honestly π
- if
PP_FLAG_DMA_SYNC_DEVis set β the page gets syncedfor_deviceusingdma_sync_single_range_for_device. so your device sees the fresh data, no stale vibes π
bestie please note: the whole function's behavior hinges on that refcnt. check it. know it. respect it. periodt π
π§ SEE ALSO π§
- Kernel file
./include/net/page_pool/helpers.hpage_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_fragment_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)
like, read the whole friend group honestly ππ
and that's the page!! π this absolute baddie of a manpage lives at ./include/net/page_pool and the date on it is October 2026, so yeah, it's from the future and it still ate β go return some pages responsibly, bestie π«Άπ
π¦ 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