[5/5] criu: Move mod preload into kdat

Submitted by Pavel Emelianov on April 26, 2017, 9:25 a.m.

Details

Message ID 5a365188-fd96-40c4-14a0-0e76bc8b52cb@virtuozzo.com
State New
Series "Speed up kdat checks"
Headers show

Commit Message

Pavel Emelianov April 26, 2017, 9:25 a.m.
Modules pre-load is also slow, but guarding this code with
the presence of criu.kdat cache file seems reasonable.

Or course, one may unload the needed modules by hands, but
such smart user may as well remove the /run/criu.kdat file :)

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/crtools.c | 6 ------
 criu/kerndat.c | 4 ++++
 2 files changed, 4 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/crtools.c b/criu/crtools.c
index 013a138..b20d2ec 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -25,11 +25,9 @@ 
 #include "crtools.h"
 #include "cr_options.h"
 #include "external.h"
-#include "sockets.h"
 #include "files.h"
 #include "sk-inet.h"
 #include "net.h"
-#include "netfilter.h"
 #include "version.h"
 #include "page-xfer.h"
 #include "tty.h"
@@ -711,9 +709,6 @@  int main(int argc, char *argv[], char *envp[])
 		pr_info("Will do snapshot from %s\n", opts.img_parent);
 
 	if (!strcmp(argv[optind], "dump")) {
-		preload_socket_modules();
-		preload_netfilter_modules();
-
 		if (!tree_id)
 			goto opt_pid_missing;
 		return cr_dump_tasks(tree_id);
@@ -727,7 +722,6 @@  int main(int argc, char *argv[], char *envp[])
 	}
 
 	if (!strcmp(argv[optind], "restore")) {
-		preload_netfilter_modules();
 		if (tree_id)
 			pr_warn("Using -t with criu restore is obsoleted\n");
 
diff --git a/criu/kerndat.c b/criu/kerndat.c
index b3c4280..157822b 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -32,6 +32,7 @@ 
 #include <compel/plugins/std/syscall-codes.h>
 #include <compel/compel.h>
 #include "linux/userfaultfd.h"
+#include "netfilter.h"
 
 struct kerndat_s kdat = {
 };
@@ -733,6 +734,9 @@  int kerndat_init(void)
 	if (ret <= 0)
 		return ret;
 
+	preload_socket_modules();
+	preload_netfilter_modules();
+
 	ret = check_pagemap();
 	if (!ret)
 		ret = kerndat_get_shmemdev();