iov_iter_extract_pages(9)
π iov_iter_extract_pages(9) π
okay so welcome to the Kernel API Manual page for iov_iter_extract_pages, bestie β this one is literally about pulling a list of contiguous pages out of an iterator, and itβs giving very βkernel internals but make it cuteβ energy β¨. no cap, every detail matters, so letβs go.
β¨ NAME β¨
iov_iter_extract_pages β Extract a list of contiguous pages from an iterator.
π SYNOPSIS π
ssize_t iov_iter_extract_pages (struct iov_iter *i , struct page ***pages , size_t maxsize , unsigned int maxpages , iov_iter_extraction_t extraction_flags , size_t *offset0 );
π ARGUMENTS π
iβ the iterator youβre extracting from, bestie.pagesβ where the list of pages gets returned.maxsizeβ the maximum amount of iterator to extract. cap it, periodt.maxpagesβ the maximum size of the list of pages.extraction_flagsβ flags that qualify the request.offset0β where the starting offset into(*pages)[0]gets returned.
π¦ DESCRIPTION π¦
okay so what it does: extract a list of contiguous pages from the current point of the iterator, and yes, it advances the iterator. the maximum number of pages and the maximum amount of page contents can be set. iconic.
If *pages is NULL, a page list will be allocated to the required size and *pages will be set to its base. If *pages is not NULL, it will be assumed that the caller allocated a page list at least maxpages in size, and this will be filled in. so like, donβt hand it a too-small list, iykyk.
extraction_flags can have ITER_ALLOW_P2PDMA set to request peer-to-peer DMA be allowed on the pages extracted. cute for when thatβs the vibe you need.
The iov_iter_extract_will_pin function can be used to query how cleanup should be performed. lowkey important.
Extra refs or pins on the pages may be obtained as follows:
- If the iterator is user-backed (
ITER_IOVEC/ITER_UBUF), pins will be added to the pages, but refs will not be taken.iov_iter_extract_will_pinwill return true. - If the iterator is
ITER_KVEC,ITER_BVEC,ITER_FOLIOQorITER_XARRAY, the pages are merely listed; no extra refs or pins are obtained.iov_iter_extract_will_pinwill return0.
Note also:
- Use with
ITER_DISCARDis not supported as that has no content.
β οΈ bestie, that ITER_DISCARD thing is a hard no β it has no content, so there is literally nothing to extract.
On success, the function sets *pages to the new pagelist, if allocated, and sets *offset0 to the offset into the first page.
It may also return -ENOMEM and -EFAULT.
πΈ SEE ALSO πΈ
Kernel file ./lib/iov_iter.c, plus these iconic little cross-refs:
_copy_mc_to_iter(9)_copy_from_iter_flushcache(9)iov_iter_folio_queue(9)iov_iter_xarray(9)iov_iter_discard(9)import_iovec(9)iov_iter_restore(9)iov_iter_extract_bvecs(9)
mwah π this cutie comes from the source/version ./lib, dated October 2026 β iov_iter_extract_pages(9), and thatβs the vibe check. π«Ά
π¦ 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