[CRIU] [PATCH v4 3/5] mem: Add is_predump argument to parasite_dump_pages_seized()

Kirill Tkhai ktkhai at virtuozzo.com
Tue Mar 22 04:22:28 PDT 2016


New argument to indicate if the function is called from pre-dump or dump.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cr-dump.c     |    4 ++--
 criu/include/mem.h |    3 ++-
 criu/mem.c         |   12 +++++++-----
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 6d3ccd1..7cd70f4 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1150,7 +1150,7 @@ static int pre_dump_one_task(struct pstree_item *item, struct list_head *ctls)
 
 	parasite_ctl->pid.virt = item->pid.virt = misc.pid;
 
-	ret = parasite_dump_pages_seized(parasite_ctl, &vmas, &parasite_ctl->mem_pp);
+	ret = parasite_dump_pages_seized(parasite_ctl, &vmas, &parasite_ctl->mem_pp, true);
 	if (ret)
 		goto err_cure;
 
@@ -1306,7 +1306,7 @@ static int dump_one_task(struct pstree_item *item)
 		}
 	}
 
-	ret = parasite_dump_pages_seized(parasite_ctl, &vmas, NULL);
+	ret = parasite_dump_pages_seized(parasite_ctl, &vmas, NULL, false);
 	if (ret)
 		goto err_cure;
 
diff --git a/criu/include/mem.h b/criu/include/mem.h
index 5269cad..cf940c2 100644
--- a/criu/include/mem.h
+++ b/criu/include/mem.h
@@ -11,7 +11,8 @@ extern int do_task_reset_dirty_track(int pid);
 extern unsigned int dump_pages_args_size(struct vm_area_list *vmas);
 extern int parasite_dump_pages_seized(struct parasite_ctl *ctl,
 				      struct vm_area_list *vma_area_list,
-				      struct page_pipe **pp);
+				      struct page_pipe **pp,
+				      bool is_predump);
 
 #define PME_PRESENT		(1ULL << 63)
 #define PME_SWAP		(1ULL << 62)
diff --git a/criu/mem.c b/criu/mem.c
index a58a871..5adf0ae 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -175,7 +175,7 @@ static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u
 }
 
 static struct parasite_dump_pages_args *prep_dump_pages_args(struct parasite_ctl *ctl,
-		struct vm_area_list *vma_area_list)
+		struct vm_area_list *vma_area_list, bool is_predump)
 {
 	struct parasite_dump_pages_args *args;
 	struct parasite_vma_entry *p_vma;
@@ -248,7 +248,8 @@ static int dump_pages(struct page_pipe *pp, struct parasite_ctl *ctl,
 static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
 		struct parasite_dump_pages_args *args,
 		struct vm_area_list *vma_area_list,
-		struct page_pipe **pp_ret)
+		struct page_pipe **pp_ret,
+		bool is_predump)
 {
 	pmc_t pmc = PMC_INIT;
 	struct page_pipe *pp;
@@ -348,12 +349,13 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
 }
 
 int parasite_dump_pages_seized(struct parasite_ctl *ctl,
-		struct vm_area_list *vma_area_list, struct page_pipe **pp)
+			       struct vm_area_list *vma_area_list,
+			       struct page_pipe **pp, bool is_predump)
 {
 	int ret;
 	struct parasite_dump_pages_args *pargs;
 
-	pargs = prep_dump_pages_args(ctl, vma_area_list);
+	pargs = prep_dump_pages_args(ctl, vma_area_list, is_predump);
 
 	/*
 	 * Add PROT_READ protection for all VMAs we're about to
@@ -370,7 +372,7 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl,
 		return ret;
 	}
 
-	ret = __parasite_dump_pages_seized(ctl, pargs, vma_area_list, pp);
+	ret = __parasite_dump_pages_seized(ctl, pargs, vma_area_list, pp, is_predump);
 	if (ret)
 		pr_err("Can't dump page with parasite\n");
 



More information about the CRIU mailing list