[CRIU] [PATCH] lazy-pages: enable lazy-pages via RPC

Adrian Reber adrian at lisas.de
Fri Jan 13 02:41:14 PST 2017


From: Adrian Reber <areber at redhat.com>

To use lazy-pages from runc '--lazy-pages' functionality needs to be
accessible via RPC. This enables lazy-pages via RPC.

The information on which port to listen is taken from the
criu_page_server_info protobuf structure. If the user has enabled
lazy-pages via RPC only criu_page_server_info.port is evaluated
to get the listen port.

With additional patches in runc is it possible to use lazy-restore
with 'runc checkpoint' and 'runc restore'.

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 criu/cr-service.c | 19 +++++++++++++------
 images/rpc.proto  |  1 +
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/criu/cr-service.c b/criu/cr-service.c
index fbd1065..7dd1398 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -357,16 +357,23 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 		opts.exec_cmd[req->n_exec_cmd] = NULL;
 	}
 
+	if (req->has_lazy_pages) {
+		opts.lazy_pages = req->lazy_pages;
+	}
+
 	if (req->ps) {
-		opts.use_page_server = true;
-		opts.addr = req->ps->address;
 		opts.port = htons((short)req->ps->port);
 
-		if (req->ps->has_fd) {
-			if (!opts.swrk_restore)
-				goto err;
+		if (!opts.lazy_pages) {
+			opts.use_page_server = true;
+			opts.addr = req->ps->address;
+
+			if (req->ps->has_fd) {
+				if (!opts.swrk_restore)
+					goto err;
 
-			opts.ps_socket = req->ps->fd;
+				opts.ps_socket = req->ps->fd;
+			}
 		}
 	}
 
diff --git a/images/rpc.proto b/images/rpc.proto
index 7cf958c..4811738 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -108,6 +108,7 @@ message criu_opts {
 	optional uint32			timeout			= 45;
 	optional bool			tcp_skip_in_flight	= 46;
 	optional bool			weak_sysctls		= 47;
+	optional bool			lazy_pages		= 48;
 }
 
 message criu_dump_resp {
-- 
2.9.3



More information about the CRIU mailing list