[CRIU] [PATCH 15/15] restore: Move uffd setup out of sigreturn_restore
Pavel Emelyanov
xemul at virtuozzo.com
Tue May 24 04:37:18 PDT 2016
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/cr-restore.c | 9 +++------
criu/include/uffd.h | 2 +-
criu/uffd.c | 8 +++++++-
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index cfa1c4e..033119a 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -560,6 +560,9 @@ static int restore_one_alive_task(int pid, CoreEntry *core)
if (prepare_mm(pid, ta))
return -1;
+ if (setup_uffd(pid, ta))
+ return -1;
+
return sigreturn_restore(pid, ta_cp, core);
}
@@ -2891,12 +2894,6 @@ static int sigreturn_restore(pid_t pid, unsigned long ta_cp, CoreEntry *core)
strncpy(task_args->comm, core->tc->comm, sizeof(task_args->comm));
- if (!opts.lazy_pages)
- task_args->uffd = -1;
- else
- if (setup_uffd(task_args, pid) != 0)
- goto err;
-
/*
* Fill up per-thread data.
*/
diff --git a/criu/include/uffd.h b/criu/include/uffd.h
index 4e1ba4a..66ce459 100644
--- a/criu/include/uffd.h
+++ b/criu/include/uffd.h
@@ -2,6 +2,6 @@
#define __CR_UFFD_H_
struct task_restore_args;
-extern int setup_uffd(struct task_restore_args *task_args, int pid);
+extern int setup_uffd(int pid, struct task_restore_args *task_args);
#endif /* __CR_UFFD_H_ */
diff --git a/criu/uffd.c b/criu/uffd.c
index c7c7d6b..4e9d46a 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -183,9 +183,15 @@ static int check_for_uffd()
}
/* This function is used by 'criu restore --lazy-pages' */
-int setup_uffd(struct task_restore_args *task_args, int pid)
+int setup_uffd(int pid, struct task_restore_args *task_args)
{
struct uffdio_api uffdio_api;
+
+ if (!opts.lazy_pages) {
+ task_args->uffd = -1;
+ return 0;
+ }
+
if (check_for_uffd())
return -1;
/*
--
2.5.0
More information about the CRIU
mailing list