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

Submitted by Pavel Emelianov on April 24, 2017, 8:07 p.m.

Details

Message ID 58FE5B03.8010209@virtuozzo.com
State New
Series "Speed up kdat checks"
Headers show

Commit Message

Pavel Emelianov April 24, 2017, 8:07 p.m.
Loading modules on each criu start is slow. Here's
the way to get criu w/o it.

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

Patch hide | download patch | download mbox

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)