From 8cf8ddfb33e66c2763e0da1fa1bff2bcfe305262 Mon Sep 17 00:00:00 2001 From: Mike Rapoport Date: Sun, 20 Nov 2016 11:50:05 +0200 Subject: [PATCH] lazy-pages: use -PID instead of -1 for zombie processes This gives somewhat saner debug messages Signed-off-by: Mike Rapoport Signed-off-by: Pavel Emelyanov --- criu/cr-restore.c | 2 +- criu/include/uffd.h | 2 +- criu/uffd.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/criu/cr-restore.c b/criu/cr-restore.c index 10413f5a9..053a2c755 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -942,7 +942,7 @@ static int restore_one_zombie(CoreEntry *core) if (inherit_fd_fini() < 0) return -1; - if (lazy_pages_setup_zombie()) + if (lazy_pages_setup_zombie(current->pid.virt)) return -1; prctl(PR_SET_NAME, (long)(void *)core->tc->comm, 0, 0, 0); diff --git a/criu/include/uffd.h b/criu/include/uffd.h index 8adf2f0f7..4d790cebf 100644 --- a/criu/include/uffd.h +++ b/criu/include/uffd.h @@ -3,7 +3,7 @@ struct task_restore_args; extern int setup_uffd(int pid, struct task_restore_args *task_args); -extern int lazy_pages_setup_zombie(void); +extern int lazy_pages_setup_zombie(int pid); extern int prepare_lazy_pages_socket(void); #endif /* __CR_UFFD_H_ */ diff --git a/criu/uffd.c b/criu/uffd.c index 8b1774107..476371a88 100644 --- a/criu/uffd.c +++ b/criu/uffd.c @@ -161,8 +161,8 @@ static int send_uffd(int sendfd, int pid) goto out; } - /* for a zombie process pid will be -1 */ - if (pid == -1) { + /* for a zombie process pid will be negative */ + if (pid < 0) { ret = 0; goto out; } @@ -200,12 +200,12 @@ static int check_for_uffd() return 0; } -int lazy_pages_setup_zombie(void) +int lazy_pages_setup_zombie(int pid) { if (!opts.lazy_pages) return 0; - if (send_uffd(0, -1)) + if (send_uffd(0, -pid)) return -1; return 0; @@ -482,7 +482,7 @@ static int ud_open(int client, struct lazy_pages_info **_lpi) } pr_debug("received PID: %d\n", lpi->pid); - if (lpi->pid == -1) { + if (lpi->pid < 0) { lpi_fini(lpi); return 0; }