[CRIU] [PATCH v2 3/7] lazy-pages: introduce lazy_pages_summary

Mike Rapoport rppt at linux.vnet.ibm.com
Mon Apr 18 06:34:34 PDT 2016


It verifies that amount of collected and transferred pages is consitent
and prints a summary

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/uffd.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/criu/uffd.c b/criu/uffd.c
index 63c945d..4219a41 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -545,6 +545,20 @@ static int handle_user_fault(int fd, struct list_head *uffd_list, void *dest)
 	return 0;
 }
 
+static int lazy_pages_summary(void)
+{
+	pr_debug("With UFFD transferred pages: (%ld/%ld)\n", uffd_copied_pages, total_pages);
+
+	if ((uffd_copied_pages != total_pages) && (total_pages > 0)) {
+		pr_warn("Only %ld of %ld pages transferred via UFFD\n", uffd_copied_pages,
+			total_pages);
+		pr_warn("Something probably went wrong.\n");
+		return 1;
+	}
+
+	return 0;
+}
+
 static int handle_requests(int fd)
 {
 	fd_set set;
@@ -602,15 +616,7 @@ static int handle_requests(int fd)
 		goto out;
 	}
 
-	pr_debug("With UFFD transferred pages: (%ld/%ld)\n", uffd_copied_pages, total_pages);
-	if ((uffd_copied_pages != total_pages) && (total_pages > 0)) {
-		pr_warn("Only %ld of %ld pages transferred via UFFD\n", uffd_copied_pages,
-			total_pages);
-		pr_warn("Something probably went wrong.\n");
-		ret = 1;
-		goto out;
-	}
-	ret = 0;
+	ret = lazy_pages_summary();
 
 out:
 	free(dest);
-- 
1.9.1



More information about the CRIU mailing list