[CRIU] [PATCH 7/7] mem: Move mem_pp from ctl to pstree_item's dmpi

Pavel Emelyanov xemul at virtuozzo.com
Wed Sep 28 00:43:05 PDT 2016


Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/cr-dump.c                  | 11 ++++++-----
 criu/include/parasite-syscall.h |  2 --
 criu/include/pstree.h           |  2 +-
 criu/mem.c                      |  2 +-
 criu/page-xfer.c                |  2 +-
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index b3a3b7c..280c713 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1465,6 +1465,7 @@ static int cr_pre_dump_finish(int ret)
 	pr_info("Pre-dumping tasks' memory\n");
 	for_each_pstree_item(item) {
 		struct parasite_ctl *ctl = dmpi(item)->parasite_ctl;
+		struct page_pipe *mem_pp;
 		struct page_xfer xfer;
 
 		if (!ctl)
@@ -1476,7 +1477,8 @@ static int cr_pre_dump_finish(int ret)
 		if (ret < 0)
 			goto err;
 
-		ret = page_xfer_dump_pages(&xfer, ctl->mem_pp, 0, true);
+		mem_pp = dmpi(item)->mem_pp;
+		ret = page_xfer_dump_pages(&xfer, mem_pp, 0, true);
 
 		xfer.close(&xfer);
 
@@ -1485,7 +1487,7 @@ static int cr_pre_dump_finish(int ret)
 
 		timing_stop(TIME_MEMWRITE);
 
-		destroy_page_pipe(ctl->mem_pp);
+		destroy_page_pipe(mem_pp);
 		parasite_cure_local(ctl);
 	}
 
@@ -1590,9 +1592,8 @@ static int cr_lazy_mem_dump(void)
 	ret = cr_page_server(false, -1);
 
 	for_each_pstree_item(item) {
-		struct parasite_ctl *ctl = dmpi(item)->parasite_ctl;
-		destroy_page_pipe(ctl->mem_pp);
-		parasite_cure_local(ctl);
+		destroy_page_pipe(dmpi(item)->mem_pp);
+		parasite_cure_local(dmpi(item)->parasite_ctl);
 	}
 
 	if (ret)
diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
index 77649d7..eba8843 100644
--- a/criu/include/parasite-syscall.h
+++ b/criu/include/parasite-syscall.h
@@ -67,8 +67,6 @@ struct parasite_ctl {
 	void			*addr_args;				/* address for arguments */
 	unsigned long		args_size;
 	int			tsock;					/* transport socket for transferring fds */
-
-	struct page_pipe	*mem_pp;
 };
 
 extern int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_imgset *cr_imgset);
diff --git a/criu/include/pstree.h b/criu/include/pstree.h
index d5053f4..17b8035 100644
--- a/criu/include/pstree.h
+++ b/criu/include/pstree.h
@@ -43,7 +43,7 @@ struct dmp_info {
 	 * threads. Dumping tasks with different creds is not supported.
 	 */
 	struct proc_status_creds *pi_creds;
-
+	struct page_pipe *mem_pp;
 	struct parasite_ctl *parasite_ctl;
 };
 
diff --git a/criu/mem.c b/criu/mem.c
index 3ffa534..6e6fcc2 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -413,7 +413,7 @@ out_pp:
 	if (ret || !(mdc->pre_dump || mdc->lazy))
 		destroy_page_pipe(pp);
 	else
-		ctl->mem_pp = pp;
+		dmpi(item)->mem_pp = pp;
 out:
 	pmc_fini(&pmc);
 	pr_info("----------------------------------------\n");
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 1ccab2a..ffcc7ff 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -632,7 +632,7 @@ static int page_server_get_pages(int sk, struct page_server_iov *pi)
 	int ret;
 
 	item = pstree_item_by_virt(pi->dst_id);
-	pp = dmpi(item)->parasite_ctl->mem_pp;
+	pp = dmpi(item)->mem_pp;
 
 	ret = page_pipe_split(pp, pi->vaddr, &pi->nr_pages);
 	if (ret)
-- 
2.5.0



More information about the CRIU mailing list