On 20.05.25 18:59, Peter Xu wrote:
Hi, Alex,
On Tue, May 20, 2025 at 08:07:19AM -0600, Alex Williamson wrote:
Peter, David, if you wouldn't mind double checking the folio usage
here, I'd appreciate it. The underlying assumption used here is that
folios always have physically contiguous pages, so we can increment at
the remainder of the folio_nr_pages() rather than iterate each page.
Yes I think so. E.g., there's comment above folio definition too:
It has consecutive PFNs, yes (i.e., pfn++). The "struct page" might not
be consecutive (i.e., page++ does not work for larger folios).
/**
* struct folio - Represents a contiguous set of bytes.
* ...
* A folio is a physically, virtually and logically contiguous set
* of bytes...
*/
For 1G, I wonder if in the future vfio can also use memfd_pin_folios()
internally when possible, e.g. after stumbled on top of a hugetlb folio
when filling the batch.
Yeah, or have a better GUP interface that gives us folio ranges instead
of individual pages.
Using memfd directly is obviously better where possible.
--
Cheers,
David / dhildenb