[CRIU] [PATCH v2] uffd: Relax reading the pstree image
Mike Rapoport
rppt at linux.vnet.ibm.com
Mon Nov 21 05:23:49 PST 2016
The uffd code only needs the pstree items themselves, not
any IDs and relations they might have.
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
What about completely moving "dummy" process tree creation to pstree.c?
I could use it for remote-lazy-pages-test page server as well.
criu/include/pstree.h | 1 +
criu/pstree.c | 17 +++++++++++++++++
criu/uffd.c | 17 +----------------
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/criu/include/pstree.h b/criu/include/pstree.h
index 5768b64..21a1ae0 100644
--- a/criu/include/pstree.h
+++ b/criu/include/pstree.h
@@ -85,6 +85,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);
diff --git a/criu/pstree.c b/criu/pstree.c
index 943518d..5e17f58 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -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;
@@ -943,6 +944,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;
diff --git a/criu/uffd.c b/criu/uffd.c
index a5c06ac..e2673da 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -805,21 +805,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;
@@ -940,7 +925,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();
--
1.9.1
More information about the CRIU
mailing list