On Wed, Apr 09, 2025 at 12:06:27PM +0300, Mike Rapoport wrote: > Now we've settled with terminology, and given that currently memdesc == > struct page, I think we need kho_preserve_folio(struct *folio) for actual > struct folios and, apparently other high order allocations, and > kho_preserve_pages(struct page *, int nr) for memblock, vmalloc and > alloc_pages_exact.
I'm not sure that is consistent with what Matthew is trying to build, I think we are trying to remove 'struct page' usage, especially for compound pages. Right now, though it is confusing, folio is the right word to encompass both page cache memory and random memdescs from other subsystems. Maybe next year we will get a memdesc API that will clarify this substantially. > On the restore path kho_restore_folio() will recreate multi-order thingy by > doing parts of what prep_new_page() does. And kho_restore_pages() will > recreate order-0 pages as if they were allocated from buddy. I don't see we need two functions, folio should handle 0 order pages just fine, and callers should generally be either not using struct page at all or using their own memdesc/folio. If we need a second function it would be a void * function that is for things that need memory but have no interest in the memdesc. Arguably this should be slab preservation. There is a corner case of preserving slab allocations >= PAGE_SIZE that is much simpler than general slab preservation, maybe that would be interesting.. I think we still don't really know what will be needed, so I'd stick with folio only as that allows building the memfd and a potential slab preservation system. Then we can see where we get to with further patches doing serialization of actual things. Jason