[CRIU] [PATCH v3 03/12] mem: reset SOFT_DIRTY bits after dumping of all vmas in the process
Eugene Batalov
eabatalov89 at gmail.com
Sun Aug 7 06:11:07 PDT 2016
From: Fyodor Bocharov <bocharovfedor at gmail.com>
Currently CRIU resets SOFT_DIRTY bits immediately after dumping of
anonymous private memory. Anonymous shared memory dumping is performed
later. So SOFT_DIRTY bits are all zeroed at the time of anon shared mem
dumping. This is invalid behavior if we want to track changes in anonymous
shared memory.
This patch changes SOFT_DIRTY bits reset moment. Now SOFT_DIRTY bits reset
is performed after dumping of all VMAs in the process.
Signed-off-by: Fyodor Bocharov <fbocharov at yandex.ru>
Signed-off-by: Eugene Batalov <eabatalov89 at gmail.com>
---
criu/cr-dump.c | 8 ++++++++
criu/include/mem.h | 1 +
criu/mem.c | 3 +--
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 60d190f..85d6e6a 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1174,6 +1174,10 @@ static int pre_dump_one_task(struct pstree_item *item)
if (ret)
goto err_cure;
+ ret = task_reset_dirty_track(pid);
+ if (ret)
+ goto err_cure;
+
if (parasite_cure_remote(parasite_ctl))
pr_err("Can't cure (pid: %d) from parasite\n", pid);
err_free:
@@ -1388,6 +1392,10 @@ static int dump_one_task(struct pstree_item *item)
goto err;
}
+ ret = task_reset_dirty_track(pid);
+ if (ret)
+ goto err;
+
close_cr_imgset(&cr_imgset);
exit_code = 0;
err:
diff --git a/criu/include/mem.h b/criu/include/mem.h
index a4696fc..cbb4aac 100644
--- a/criu/include/mem.h
+++ b/criu/include/mem.h
@@ -6,6 +6,7 @@ struct vm_area_list;
struct page_pipe;
struct pstree_item;
+extern int task_reset_dirty_track(int pid);
extern int prepare_mm_pid(struct pstree_item *i);
extern int do_task_reset_dirty_track(int pid);
extern unsigned int dump_pages_args_size(struct vm_area_list *vmas);
diff --git a/criu/mem.c b/criu/mem.c
index d4b337a..ee50e20 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -30,7 +30,7 @@
#include "protobuf.h"
#include "images/pagemap.pb-c.h"
-static int task_reset_dirty_track(int pid)
+int task_reset_dirty_track(int pid)
{
int ret;
@@ -378,7 +378,6 @@ again:
* Step 4 -- clean up
*/
- ret = task_reset_dirty_track(ctl->pid.real);
out_xfer:
if (should_xfer)
xfer.close(&xfer);
--
1.9.1
More information about the CRIU
mailing list