Re: [PATCH 1/2] mm: memfd_luo: always make all folios uptodate
From: Mike Rapoport
Date: Fri Mar 06 2026 - 10:45:58 EST
On Thu, Mar 05, 2026 at 09:50:18AM +0100, Pratyush Yadav wrote:
> On Wed, Feb 25 2026, Mike Rapoport wrote:
>
> > On Mon, Feb 23, 2026 at 06:39:28PM +0100, Pratyush Yadav wrote:
> [...]
> >> +
> >> + /*
> >> + * If the folio is not uptodate, it was fallocated but never
> >> + * used. Saving this flag at prepare() doesn't work since it
> >> + * might change later when someone uses the folio.
> >> + *
> >> + * Since we have taken the performance penalty of allocating,
> >> + * zeroing, and pinning all the folios in the holes, take a bit
> >> + * more and zero all non-uptodate folios too.
> >> + *
> >> + * NOTE: For someone looking to improve preserve performance,
> >> + * this is a good place to look.
> >
> > I'd add a larger comment above memfd_luo_preserve_folios() that says that
> > it allocates, pins etc and fold the last two paragraphs of this comment
> > there.
>
> How about this:
>
> /*
> * If the folio is not uptodate, it was fallocated but never
> * used. Saving this flag at prepare() doesn't work since it
> * might change later when the folio is used. Make it uptodate
> * now to avoid this problem.
> */
> if (!folio_test_uptodate(folio)) {
>
> And the comment above memfd_pin_folios() gets this:
>
> * NOTE: For someone looking to improve preserve performance, this is a
> * good place to look. Also look at the folio zeroing below.
Looks great to me
> [...]
>
> --
> Regards,
> Pratyush Yadav
--
Sincerely yours,
Mike.