Re: [PATCH v7 14/22] mm: memfd_luo: allow preserving memfd

From: Pasha Tatashin

Date: Sun Nov 23 2025 - 22:14:17 EST


> > +unlock_folio:
> > + folio_unlock(folio);
> > + folio_put(folio);
> > + i++;
>
> I'd add a counter and use it int the below for loop.

Done.

>
> > +put_folios:
> > + /*
> > + * Note: don't free the folios already added to the file. They will be
> > + * freed when the file is freed. Free the ones not added yet here.
> > + */
> > + for (; i < nr_folios; i++) {
> > + const struct memfd_luo_folio_ser *pfolio = &folios_ser[i];
> > +
> > + folio = kho_restore_folio(pfolio->pfn);
> > + if (folio)
> > + folio_put(folio);
> > + }
> > +
> > + return err;
> > +}
>
> Reviewed-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>

Thanks!

Pasha

>
> --
> Sincerely yours,
> Mike.