[CRIU] [PATCH 2/7] kdat: move kerndat initialization to the very beginning

Mike Rapoport rppt at linux.vnet.ibm.com
Tue Aug 15 09:23:49 MSK 2017


With kdat cache and unified kerndat_init() we can call it very early in
crtools and then kdat information will be available for all cr-* actions.

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/cr-dump.c    | 6 ------
 criu/cr-restore.c | 3 ---
 criu/crtools.c    | 3 +++
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 06f3966..5d453c2 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1641,9 +1641,6 @@ int cr_pre_dump_tasks(pid_t pid)
 	if (cr_plugin_init(CR_PLUGIN_STAGE__PRE_DUMP))
 		goto err;
 
-	if (kerndat_init())
-		goto err;
-
 	if (lsm_check_opts())
 		goto err;
 
@@ -1837,9 +1834,6 @@ int cr_dump_tasks(pid_t pid)
 	if (cr_plugin_init(CR_PLUGIN_STAGE__DUMP))
 		goto err;
 
-	if (kerndat_init())
-		goto err;
-
 	if (lsm_check_opts())
 		goto err;
 
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 6a11e39..04c98f3 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -2458,9 +2458,6 @@ int cr_restore_tasks(void)
 	if (init_stats(RESTORE_STATS))
 		goto err;
 
-	if (kerndat_init())
-		goto err;
-
 	if (lsm_check_opts())
 		goto err;
 
diff --git a/criu/crtools.c b/criu/crtools.c
index cee0c94..66e9c84 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -536,6 +536,9 @@ int main(int argc, char *argv[], char *envp[])
 	if (init_service_fd())
 		return 1;
 
+	if (kerndat_init())
+		return 1;
+
 	if (!strcmp(argv[1], "swrk")) {
 		if (argc < 3)
 			goto usage;
-- 
2.7.4



More information about the CRIU mailing list