[CRIU] [PATCH 6/7] lazy-pages: use -PID instead of -1 for zombie processes

Mike Rapoport rppt at linux.vnet.ibm.com
Sun Nov 20 01:50:05 PST 2016


This gives somewhat saner debug messages

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 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 4d846e8..d24c324 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -813,7 +813,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 8adf2f0..4d790ce 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 3e3f320..a071b8e 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;
 	}
-- 
1.9.1



More information about the CRIU mailing list