[CRIU] [PATCH v2 06/11] criu: page-xfer: add ability to skip writing lazy pages

Mike Rapoport rppt at linux.vnet.ibm.com
Tue May 31 06:34:56 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 6648dd4..2d529fd 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1430,7 +1430,7 @@ static int cr_pre_dump_finish(struct list_head *ctls, 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 a44ad69..66ca227 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -254,7 +254,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 6561b0a..786516e 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -321,7 +321,7 @@ int open_page_xfer(struct page_xfer *xfer, int fd_type, long id)
 }
 
 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;
@@ -359,6 +359,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 18acd15..54ffdda 100644
--- a/criu/shmem.c
+++ b/criu/shmem.c
@@ -539,7 +539,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 *si)
-- 
1.9.1



More information about the CRIU mailing list