On Fri, Aug 05, 2022 at 02:46:26PM +0200, David Hildenbrand wrote: > Can you explain how "zero copy snapshots of processes" would work, both > > a) From a user space POV > b) From a kernel-internal POV > > Especially, what I get is that you have a filesystem on that memory > region, and all memory that is not used for filesystem blocks can be > used as ordinary system RAM (a little like shmem, but restricted to dax > memory regions?). > > But how does this interact with zero-copy snapshots? > > I feel like I am missing one piece where we really need system RAM as > part of the bigger picture. Hopefully it's not some hack that converts > system RAM to file system blocks :) My proposal probably falls into this category. The idea is that if we have the persistent filesystem in the same space as system RAM, we could make most of the process pages part of a snapshot file by holding references to the these pages and making the pages copy-on-write for the process, in about the same way a forked child would. (I still don't have this piece fully worked out. May be there are reasons why this won't work or will make something else difficult, and that is why you are advising against it.) Regarding the userspace and kernel POV: The userspace operation would be that the process tries to save or restore its pages using vmsplice(). In the kernel, this would be implemented using a filesystem which shares pages with system RAM and uses a zero-copy COW mechanism for those process pages which can be shared with the filesystem. I had earlier been thinking of having a different interface to the kernel, which creates a file with only those memory pages which can be saved using COW and also indicates to the caller which pages have actually been saved. But having a vmsplice implementation which does COW as far as possible keeps the userspace process indicating the desired function (saving or restoring memory pages) and the kernel implementation handling the zero copy as an optimization where possible. Thanks, Srinivas