Commit 3df6627e authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

restore: Move uffd setup out of sigreturn_restore

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent a263aec6
......@@ -848,6 +848,9 @@ static int restore_one_alive_task(int pid, CoreEntry *core)
if (prepare_vmas(current, ta))
return -1;
if (setup_uffd(pid, ta))
return -1;
return sigreturn_restore(pid, ta, args_len, core);
}
......@@ -3205,12 +3208,6 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns
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.
*/
......
......@@ -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_ */
......@@ -182,9 +182,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;
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment