[CRIU] [PATCH 09/11] lazy-pages: introduce lazy_pages_summary

Mike Rapoport rppt at linux.vnet.ibm.com
Sun Apr 10 23:19:52 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 | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/criu/uffd.c b/criu/uffd.c
index 7fadd06..25b3db0 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -560,6 +560,21 @@ out:
 	return ret;
 }
 
+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;
+
+}
+
 #define POLL_TIMEOUT 5000
 
 static int handle_requests(int listen, struct sockaddr_un *saddr)
@@ -650,15 +665,7 @@ static int handle_requests(int listen, struct sockaddr_un *saddr)
 		}
 	}
 
-	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:
 	for (i = nr_pollfd - 1; i > 0; i--)
-- 
1.9.1



More information about the CRIU mailing list