Commit 8cf8ddfb authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

lazy-pages: use -PID instead of -1 for zombie processes

This gives somewhat saner debug messages
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent d66d5cdd
...@@ -942,7 +942,7 @@ static int restore_one_zombie(CoreEntry *core) ...@@ -942,7 +942,7 @@ static int restore_one_zombie(CoreEntry *core)
if (inherit_fd_fini() < 0) if (inherit_fd_fini() < 0)
return -1; return -1;
if (lazy_pages_setup_zombie()) if (lazy_pages_setup_zombie(current->pid.virt))
return -1; return -1;
prctl(PR_SET_NAME, (long)(void *)core->tc->comm, 0, 0, 0); prctl(PR_SET_NAME, (long)(void *)core->tc->comm, 0, 0, 0);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
struct task_restore_args; struct task_restore_args;
extern int setup_uffd(int pid, struct task_restore_args *task_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); extern int prepare_lazy_pages_socket(void);
#endif /* __CR_UFFD_H_ */ #endif /* __CR_UFFD_H_ */
...@@ -161,8 +161,8 @@ static int send_uffd(int sendfd, int pid) ...@@ -161,8 +161,8 @@ static int send_uffd(int sendfd, int pid)
goto out; goto out;
} }
/* for a zombie process pid will be -1 */ /* for a zombie process pid will be negative */
if (pid == -1) { if (pid < 0) {
ret = 0; ret = 0;
goto out; goto out;
} }
...@@ -200,12 +200,12 @@ static int check_for_uffd() ...@@ -200,12 +200,12 @@ static int check_for_uffd()
return 0; return 0;
} }
int lazy_pages_setup_zombie(void) int lazy_pages_setup_zombie(int pid)
{ {
if (!opts.lazy_pages) if (!opts.lazy_pages)
return 0; return 0;
if (send_uffd(0, -1)) if (send_uffd(0, -pid))
return -1; return -1;
return 0; return 0;
...@@ -482,7 +482,7 @@ static int ud_open(int client, struct lazy_pages_info **_lpi) ...@@ -482,7 +482,7 @@ static int ud_open(int client, struct lazy_pages_info **_lpi)
} }
pr_debug("received PID: %d\n", lpi->pid); pr_debug("received PID: %d\n", lpi->pid);
if (lpi->pid == -1) { if (lpi->pid < 0) {
lpi_fini(lpi); lpi_fini(lpi);
return 0; return 0;
} }
......
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