Re: [PATCH v3 29/30] luo: allow preserving memfd
From: Jason Gunthorpe
Date: Wed Sep 03 2025 - 12:40:59 EST
On Wed, Sep 03, 2025 at 03:59:40PM +0000, Pasha Tatashin wrote:
> vmalloc is always fully populated, but if we add support for
> preserving an area with holes, it can also be used for preserving
> vmalloc.
Why? If you can't create it with vmap what is the point?
> By the way, I don't like calling it *vmalloc* preservation
> because we aren't preserving the original virtual addresses; we are
> preserving a list of pages that are reassembled into a virtually
> contiguous area. Maybe kho map, or kho page map, not sure, but vmalloc
> does not sound right to me.
No preservation retains the virtual address, that is pretty much
universal.
It is vmalloc preservation because the flow is
x = vmalloc()
kho_preserve_vmalloc(x, &preserved)
[..]
x = kho_restore_vmalloc(preserved)
vfree(x)
It is the same naming as folio preservation. Upon restore you get a
vmalloc() back.
> > And again in real systems we expect memfd to be fully populated too.
>
> I thought so too, but we already have a use case for slightly sparse
> memfd, unfortunately, that becomes *very* inefficient when fully
> populated.
Really? Why not use multiple memfds :(
So maybe you need to do optimized sparseness in memfd :(
Jason