[CRIU] [PATCH 7/7] Adding --pre-dump-mode option

Abhishek Dubey dubeyabhishek777 at gmail.com
Wed Aug 21 02:07:02 MSK 2019


There exists two modes of pre-dump algorithm:
1) splicing memory by parasite
    --pre-dump-mode=splice
2) using process_vm_readv syscall
    --pre-dump-mode=read

This patch covers new option addition to criu
and zdtm suite.

Signed-off-by: Abhishek Dubey <dubeyabhishek777 at gmail.com>
---
 Documentation/criu.txt    | 6 ++++++
 criu/config.c             | 7 +++++++
 criu/include/cr_options.h | 1 +
 test/zdtm.py              | 8 +++++++-
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/criu.txt b/Documentation/criu.txt
index 94fc542..674967f 100644
--- a/Documentation/criu.txt
+++ b/Documentation/criu.txt
@@ -156,6 +156,12 @@ In addition, *page-server* options may be specified.
     Turn on memory changes tracker in the kernel. If the option is
     not passed the memory tracker get turned on implicitly.
 
+*--pre-dump-mode*='mode'::
+    There are two 'mode' to operate pre-dump algorithm. The 'splice' mode
+    is parasite based, whereas 'read' mode is based on process_vm_readv
+    syscall. The 'read' mode incurs reduced frozen time and reduced
+    memory pressure as compared to 'splice' mode. Default is 'splice' mode.
+
 *dump*
 ~~~~~~
 Performs a checkpoint procedure.
diff --git a/criu/config.c b/criu/config.c
index 3a54afd..6cadc5c 100644
--- a/criu/config.c
+++ b/criu/config.c
@@ -517,6 +517,7 @@ int parse_options(int argc, char **argv, bool *usage_error,
 		{ "tls-key",			required_argument,	0, 1095},
 		BOOL_OPT("tls", &opts.tls),
 		{"tls-no-cn-verify",		no_argument,		&opts.tls_no_cn_verify, true},
+		{ "pre-dump-mode",		required_argument,	0, 1096},
 		{ },
 	};
 
@@ -815,6 +816,12 @@ int parse_options(int argc, char **argv, bool *usage_error,
 		case 1095:
 			SET_CHAR_OPTS(tls_key, optarg);
 			break;
+		case 1096:
+			if (!strcmp("read", optarg))
+				opts.pre_dump_mode = PRE_DUMP_READ;
+			else
+				opts.pre_dump_mode = PRE_DUMP_SPLICE;
+			break;
 		case 'V':
 			pr_msg("Version: %s\n", CRIU_VERSION);
 			if (strcmp(CRIU_GITID, "0"))
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index 6b84e31..17fe15f 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -86,6 +86,7 @@ struct cr_options {
 	int			evasive_devices;
 	int			link_remap_ok;
 	int			log_file_per_pid;
+	int			pre_dump_mode;
 	bool			swrk_restore;
 	char			*output;
 	char			*root;
diff --git a/test/zdtm.py b/test/zdtm.py
index 9b93a51..ccf7733 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -1020,6 +1020,7 @@ class criu:
         self.__tls = self.__tls_options() if opts['tls'] else []
         self.__criu_bin = opts['criu_bin']
         self.__crit_bin = opts['crit_bin']
+        self.__pre_dump_mode = opts['pre_dump_mode']
 
     def fini(self):
         if self.__lazy_migrate:
@@ -1276,6 +1277,8 @@ class criu:
             a_opts += ['--leave-stopped']
         if self.__empty_ns:
             a_opts += ['--empty-ns', 'net']
+        if self.__pre_dump_mode:
+            a_opts += ["--pre-dump-mode", "%s" % self.__pre_dump_mode]
 
         nowait = False
         if self.__lazy_migrate and action == "dump":
@@ -1865,7 +1868,7 @@ class Launcher:
               'sat', 'script', 'rpc', 'lazy_pages', 'join_ns', 'dedup', 'sbs',
               'freezecg', 'user', 'dry_run', 'noauto_dedup',
               'remote_lazy_pages', 'show_stats', 'lazy_migrate', 'remote',
-              'tls', 'criu_bin', 'crit_bin')
+              'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode')
         arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd}))
 
         if self.__use_log:
@@ -2512,6 +2515,9 @@ rp.add_argument("--criu-bin",
 rp.add_argument("--crit-bin",
                 help="Path to crit binary",
                 default='../crit/crit')
+rp.add_argument("--pre-dump-mode",
+                help="Use splice or sys_vm_readv syscall for pre-dumping",
+                default='splice')
 
 lp = sp.add_parser("list", help="List tests")
 lp.set_defaults(action=list_tests)
-- 
2.7.4



More information about the CRIU mailing list