On Thu, May 25, 2023 at 09:45:34PM +0100, Matthew Wilcox wrote:
Isn't "long term pinning" the wrong description of the problem? Long term
pins suggest to me FOLL_LONGTERM. I think this is simple short term
pins that we care about here.
vfio pins are held for a long time - Steve
So this is a third sense of "pinned pages" that is neither what
filesystems nor the mm means by pinned pages, but whatever it is that
vfio means by pinned pages? If only "pin" weren't such a desirable
word. Can somebody explain to me in small words what a vfio pin looks
like because I've tried reading vfio_iommu_type1_pin_pages() and I
don't recognise anything there that looks like pinning in either of
the other two senses.
Oh, I think I found it! pin_user_pages_remote() is called by
vaddr_get_pfns(). If these are the pages you're concerned about,
then the efficient way to do what you want is simply to call
folio_maybe_dma_pinned(). Far more efficient than the current mess
of total_mapcount().