Re: [RFC PATCH 00/26] hugetlb: Introduce HugeTLB high-granularity mapping
From: Peter Xu
Date: Thu Jun 30 2022 - 12:09:20 EST
On Tue, Jun 28, 2022 at 09:20:41AM +0100, Dr. David Alan Gilbert wrote:
> One other thing I thought of; you provide the modified 'CONTINUE'
> behaviour, which works for postcopy as long as you use two mappings in
> userspace; one protected by userfault, and one which you do the writes
> to, and then issue the CONTINUE into the protected mapping; that's fine,
> but it's not currently how we have our postcopy code wired up in qemu,
> we have one mapping and use UFFDIO_COPY to place the page.
> Requiring the two mappings is fine, but it's probably worth pointing out
> the need for it somewhere.
It'll be about CONTINUE, maybe not directly related to sub-page mapping,
but indeed that's something we may need to do. It's also in my poc [1]
previously (I never got time to get back to it yet though..).
It's just that two mappings are not required. E.g., one could use a fd on
the file and lseek()/write() to the file to update content rather than
using another mapping. It might be just slower.
Or, IMHO an app can legally just delay faulting of some mapping using minor
mode and maybe the app doesn't even need to modify the page content before
CONTINUE for some reason, then it's even not needed to have either the
other mapping or the fd. Fundamentally, MINOR mode and CONTINUE provides
another way to trap page fault when page cache existed. It doesn't really
define whether or how the data will be modified.
It's just that for QEMU unfortunately we may need to have that two mappings
just for this use case indeed..
[1] https://github.com/xzpeter/qemu/commit/41538a9a8ff5c981af879afe48e4ecca9a1aabc8
Thanks,
--
Peter Xu