2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

uffd: Relax reading the pstree image (v2)

The uffd code only needs the pstree items themselves, not
any IDs and relations they might have.

travis-ci: success for Some more cleanups over uffd.c (rev3)
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Mike Rapoport
2016-11-22 15:10:35 +03:00
committed by Andrei Vagin
parent 12c0f452fe
commit f30cca66ec
3 changed files with 19 additions and 16 deletions

View File

@@ -100,6 +100,7 @@ extern struct pstree_item *pstree_item_next(struct pstree_item *item);
extern bool restore_before_setsid(struct pstree_item *child);
extern int prepare_pstree(void);
extern int prepare_dummy_pstree(void);
extern int dump_pstree(struct pstree_item *root_item);

View File

@@ -16,6 +16,7 @@
#include "util.h"
#include "protobuf.h"
#include "images/pstree.pb-c.h"
#include "crtools.h"
struct pstree_item *root_item;
static struct rb_root pid_root_rb;
@@ -950,6 +951,22 @@ int prepare_pstree(void)
return ret;
}
int prepare_dummy_pstree(void)
{
pid_t dummy = 0;
if (check_img_inventory() == -1)
return -1;
if (prepare_task_entries() == -1)
return -1;
if (read_pstree_image(&dummy) == -1)
return -1;
return 0;
}
bool restore_before_setsid(struct pstree_item *child)
{
int csid = child->born_sid == -1 ? child->sid : child->born_sid;

View File

@@ -781,21 +781,6 @@ 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;
return 0;
}
static int prepare_epoll(int nr_fds, struct epoll_event **events)
{
int epollfd;
@@ -915,7 +900,7 @@ int cr_lazy_pages(bool daemon)
if (check_for_uffd())
return -1;
if (lazy_pages_prepare_pstree())
if (prepare_dummy_pstree())
return -1;
lazy_sk = prepare_lazy_socket();