iov_iter_extract_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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_pin will return true.
  • If the iterator is ITER_KVEC, ITER_BVEC, ITER_FOLIOQ or ITER_XARRAY, the pages are merely listed; no extra refs or pins are obtained. iov_iter_extract_will_pin will return 0.

Note also:

  • Use with ITER_DISCARD is 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:

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