Commit 7c78a48b authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

lazy-pages: initialize process tree early

Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 1c54c003
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <poll.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -430,19 +431,8 @@ static int find_vmas(struct list_head *uffd_list) ...@@ -430,19 +431,8 @@ static int find_vmas(struct list_head *uffd_list)
struct page_read pr; struct page_read pr;
struct uffd_pages_struct *uffd_pages; struct uffd_pages_struct *uffd_pages;
if (check_img_inventory() == -1)
return -1;
vm_area_list_init(&vmas); vm_area_list_init(&vmas);
/* Allocate memory for task_entries */
if (prepare_task_entries() == -1)
return -1;
if (prepare_pstree() == -1)
return -1;
ri = rsti(root_item); ri = rsti(root_item);
if (!ri) if (!ri)
return -1; return -1;
...@@ -633,6 +623,27 @@ out: ...@@ -633,6 +623,27 @@ out:
} }
static int lazy_pages_prepare_pstree(void)
{
if (check_img_inventory() == -1)
return -1;
/* Allocate memory for task_entries */
if (prepare_task_entries() == -1)
return -1;
if (prepare_pstree() == -1)
return -1;
/* bail out early until we know how to handle multiple tasks */
if (task_entries->nr_tasks > 1) {
pr_msg("lazy-pages cannot restore more than one task, sorry\n");
return -1;
}
return 0;
}
int cr_lazy_pages() int cr_lazy_pages()
{ {
int listen; int listen;
...@@ -649,6 +660,9 @@ int cr_lazy_pages() ...@@ -649,6 +660,9 @@ int cr_lazy_pages()
return -1; return -1;
} }
if (lazy_pages_prepare_pstree())
return -1;
pr_debug("Waiting for incoming connections on %s\n", opts.addr); pr_debug("Waiting for incoming connections on %s\n", opts.addr);
if ((listen = server_listen(&saddr)) < 0) { if ((listen = server_listen(&saddr)) < 0) {
pr_perror("server_listen error"); pr_perror("server_listen error");
......
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