[CRIU] [PATCH v4 2/2] lazy-pages: add support to combine pre-copy and post-copy
Adrian Reber
adrian at lisas.de
Thu Sep 22 00:45:11 PDT 2016
From: Adrian Reber <areber at redhat.com>
Only the UFFD daemon is aware if pages are in the parent or not. The
restore will continue to work as any lazy-restore except that pages from
parent checkpoints will be pre-populated by the restorer.
The restorer will still register the whole memory region as being
handled by userfaultfd even if it contains pages from parent
checkpoints. Userfaultfd page faults will only happen on pages which
contain no data. This means from the parent pre-populated pages will not
trigger a userfaultfd message even if marked as being handled by
userfaultfd.
The UFFD daemon knows about pages which are available in the parent
checkpoints and will not push those pages unnecessarily to userfaultfd.
Following steps to migrate a process are now possible:
Source system:
* criu pre-dump -D /tmp/cp/1 -t <PID>
* rsync -a /tmp/cp <destination>:/tmp
* criu dump -D /tmp/cp/2 -t <PID> --port 27 --lazy-pages \
--prev-images-dir ../1/ --track-mem
Destination system:
* rsync -a <source>:/tmp/cp /tmp/
* criu lazy-pages --page-server --address <source> --port 27 \
-D /tmp/cp/2 &
* criu restore --lazy-pages -D /tmp/cp/2
This will now restore all pages from the parent checkpoint if they
are not marked as lazy in the second checkpoint.
v2:
- changed parent detection to use pagemap_in_parent()
v3:
- unfortunately this reverts
c11cf95afbe023a2816a3afaecb65cc4fee670d7
"criu: mem: skip lazy pages during restore based on pagemap info"
To be able to split the VMA-s in the right chunks for the restorer
it is necessary to make the decision lazy or not on the VmaEntry
level.
v4:
- everything has changed thanks to Mike Rapoport's suggestion
- the VMA-s are no longer touched or split
- instead of over 100 lines of changes this is now two line patch
Signed-off-by: Adrian Reber <areber at redhat.com>
---
criu/uffd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/criu/uffd.c b/criu/uffd.c
index 81dc7ae..fbf1cb6 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -508,7 +508,8 @@ static int collect_uffd_pages(struct page_read *pr, struct lazy_pages_info *lpi)
*/
if (base >= vma->e->start && base < vma->e->end) {
if (vma_entry_can_be_lazy(vma->e)) {
- uffd_page = true;
+ if(!pagemap_in_parent(pr->pe))
+ uffd_page = true;
break;
}
}
--
2.7.4
More information about the CRIU
mailing list