Re: [PATCH v4 2/3] gup: introduce unpin_user_folio_dirty_locked()

From: lizhe . 67
Date: Wed Jun 18 2025 - 08:25:04 EST


On Wed, 18 Jun 2025 08:56:22 -0300, jgg@xxxxxxxx wrote:

> On Wed, Jun 18, 2025 at 01:52:37PM +0200, David Hildenbrand wrote:
>
> > I thought we also wanted to optimize out the
> > is_invalid_reserved_pfn() check for each subpage of a folio.

Yes, that is an important aspect of our optimization.

> VFIO keeps a tracking structure for the ranges, you can record there
> if a reserved PFN was ever placed into this range and skip the check
> entirely.
>
> It would be very rare for reserved PFNs and non reserved will to be
> mixed within the same range, userspace could cause this but nothing
> should.

Yes, but it seems we don't have a very straightforward interface to
obtain the reserved attribute of this large range of pfns. Moreover,
this implies that we need to move the logic of the
is_invalid_reserved_pfn() check to another process. I'm not sure if
this is necessary.

Thanks,
Zhe