Re: [PATCH v3 07/30] kho: add interfaces to unpreserve folios and physical memory ranges
From: Jason Gunthorpe
Date: Mon Aug 18 2025 - 10:03:10 EST
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.
The use case is simply to get some memory to preserve, it should work
in terms of void *. We don't support slab today so this has to be
emulated with full pages, but this detail should not leak out of the
API.
Jason