[CRIU] [PATCH RFC 5/8] criu: page-xfer: add ability to skip writing lazy pages

Mike Rapoport rppt at linux.vnet.ibm.com
Sat May 21 03:49:39 PDT 2016


Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/cr-dump.c           | 2 +-
 criu/include/page-xfer.h | 2 +-
 criu/mem.c               | 2 +-
 criu/page-xfer.c         | 4 +++-
 criu/shmem.c             | 2 +-
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 5d9520f..1a551b4 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1429,7 +1429,7 @@ static int cr_pre_dump_finish(int ret)
 		if (ret < 0)
 			goto err;
 
-		ret = page_xfer_dump_pages(&xfer, ctl->mem_pp, 0);
+		ret = page_xfer_dump_pages(&xfer, ctl->mem_pp, 0, true);
 
 		xfer.close(&xfer);
 
diff --git a/criu/include/page-xfer.h b/criu/include/page-xfer.h
index 8492daa..fb222c3 100644
--- a/criu/include/page-xfer.h
+++ b/criu/include/page-xfer.h
@@ -38,7 +38,7 @@ struct page_xfer {
 extern int open_page_xfer(struct page_xfer *xfer, int fd_type, long id);
 struct page_pipe;
 extern int page_xfer_dump_pages(struct page_xfer *, struct page_pipe *,
-				unsigned long off);
+				unsigned long off, bool dump_lazy);
 extern int connect_to_page_server(void);
 extern int disconnect_from_page_server(void);
 
diff --git a/criu/mem.c b/criu/mem.c
index 0497975..6c9b91b 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -249,7 +249,7 @@ static int dump_pages(struct page_pipe *pp, struct parasite_ctl *ctl,
 	 */
 	if (xfer) {
 		timing_start(TIME_MEMWRITE);
-		ret = page_xfer_dump_pages(xfer, pp, 0);
+		ret = page_xfer_dump_pages(xfer, pp, 0, true);
 		timing_stop(TIME_MEMWRITE);
 	}
 
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 2ebe8cc..c1716a5 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -587,7 +587,7 @@ static void close_page_xfer(struct page_xfer *xfer)
 }
 
 int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
-		unsigned long off)
+			 unsigned long off, bool dump_lazy)
 {
 	struct page_pipe_buf *ppb;
 	struct iovec *hole = NULL;
@@ -625,6 +625,8 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
 
 			if (xfer->write_pagemap(xfer, iov))
 				return -1;
+			if (!dump_lazy && ppb->flags & PPB_LAZY)
+				continue;
 			if (xfer->write_pages(xfer, ppb->p[0], iov->iov_len))
 				return -1;
 		}
diff --git a/criu/shmem.c b/criu/shmem.c
index 05458c7..140ac1f 100644
--- a/criu/shmem.c
+++ b/criu/shmem.c
@@ -346,7 +346,7 @@ static int dump_pages(struct page_pipe *pp, struct page_xfer *xfer, void *addr)
 			return -1;
 		}
 
-	return page_xfer_dump_pages(xfer, pp, (unsigned long)addr);
+	return page_xfer_dump_pages(xfer, pp, (unsigned long)addr, true);
 }
 
 static int dump_one_shmem(struct shmem_info_dump *si)
-- 
1.9.1



More information about the CRIU mailing list