Re: [PATCH v3 07/30] kho: add interfaces to unpreserve folios and physical memory ranges
From: Pasha Tatashin
Date: Sun Sep 21 2025 - 18:21:28 EST
On Mon, Aug 18, 2025 at 9:55 AM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
>
> On Fri, Aug 15, 2025 at 12:12:10PM +0300, Mike Rapoport wrote:
> > > Which is perhaps another comment, if this __get_free_pages() is going
> > > to be a common pattern (and I guess it will be) then the API should be
> > > streamlined alot more:
> > >
> > > void *kho_alloc_preserved_memory(gfp, size);
> > > void kho_free_preserved_memory(void *);
> >
> > This looks backwards to me. KHO should not deal with memory allocation,
> > it's responsibility to preserve/restore memory objects it supports.
>
> Then maybe those are luo_ helpers
>
> But having users open code __get_free_pages() and convert to/from
> struct page, phys, etc is not a great idea.
I added:
void *luo_contig_alloc_preserve(size_t size);
void luo_contig_free_unpreserve(void *mem, size_t size);
Allocate contiguous, zeroed, and preserved memory.
Pasha