[CRIU] [PATCH 04/12] config: Config option for no mod preload

Pavel Emelyanov xemul at virtuozzo.com
Mon Apr 24 13:07:31 PDT 2017


Loading modules on each criu start is slow. Here's
the way to get criu w/o it.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/netfilter.c | 4 +++-
 criu/sockets.c   | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/criu/netfilter.c b/criu/netfilter.c
index 5942eb0..c24eb84 100644
--- a/criu/netfilter.c
+++ b/criu/netfilter.c
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 
 #include "../soccr/soccr.h"
-
+#include "config.h"
 #include "util.h"
 #include "common/list.h"
 #include "files.h"
@@ -30,6 +30,7 @@ static char iptable_cmd_ipv6[] = "ip6tables";
 
 void preload_netfilter_modules(void)
 {
+#ifndef CONFIG_NO_MODULES_PRELOAD
 	int fd = -1;
 
 	/* same as socket modules, ip_tables and ip6_tables will be loaded by
@@ -45,6 +46,7 @@ void preload_netfilter_modules(void)
 	cr_system(fd, fd, fd, iptable_cmd_ipv6,
 		(char *[]) { iptable_cmd_ipv6, "-L", "-n", NULL}, 0);
 	close_safe(&fd);
+#endif
 }
 
 static int nf_connection_switch_raw(int family, u32 *src_addr, u16 src_port,
diff --git a/criu/sockets.c b/criu/sockets.c
index 5d006a3..a5e9a14 100644
--- a/criu/sockets.c
+++ b/criu/sockets.c
@@ -10,6 +10,7 @@
 #include <string.h>
 #include <netinet/in.h>
 
+#include "config.h"
 #include "int.h"
 #include "bitops.h"
 #include "libnetlink.h"
@@ -144,6 +145,7 @@ static inline void probe_diag(int nl, struct sock_diag_req *req, int expected_er
 
 void preload_socket_modules(void)
 {
+#ifndef CONFIG_NO_MODULES_PRELOAD
 	int nl;
 	struct sock_diag_req req;
 
@@ -207,6 +209,7 @@ void preload_socket_modules(void)
 
 	close(nl);
 	pr_info("Done probing\n");
+#endif
 }
 
 static int dump_bound_dev(int sk, SkOptsEntry *soe)
-- 
2.5.5



More information about the CRIU mailing list