Re: [PATCH v4 18/19] mm: memfd_luo: Add feature header to struct memfd_luo_folio_ser

From: Pratyush Yadav

Date: Thu Nov 26 2026 - 13:49:39 EST


On Tue, Nov 10 2026, Tarun Sahu wrote:

> Precede each serialized folio entry in the preserved memfd folio array
> with struct kho_ser_hdr via DECLARE_KHO_SER so future per-folio memfd
> features can append fields to struct memfd_luo_folio_ser without breaking
> compatibility between adjacent kernels.
>
> Allocate the preserved folio array using kho_ser_size(memfd_luo_folio_ser)
> per entry and initialize each entry feature header in
> memfd_luo_preserve_folios(). On the incoming path in
> memfd_luo_discard_folios() and memfd_luo_retrieve_folios(), validate each
> entry feature header with kho_ser_validate() and advance between entries
> using fhdr->size so entries written with a different feature layout are
> traversed accurately.

No. The flags in each folio entry is a part of memfd's ABI. These flags
don't have an ABI of their own. If the layout of memfd_luo_folio_ser
changes, it goes in the memfd_luo_ser flags.

Doubling the memory needed to preserve a memfd is not acceptable.

[...]

--
Regards,
Pratyush Yadav