[CRIU] [PATCH 1/3] uffd: increment uffd_copied_pages only in one place

Mike Rapoport rppt at linux.vnet.ibm.com
Thu Mar 31 04:39:19 PDT 2016


The uffd_copied_pages can be incremented in uffd_copy_page function rather
than in its callers

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

diff --git a/criu/uffd.c b/criu/uffd.c
index b06e4ac..79c693d 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -274,6 +274,7 @@ static int uffd_copy_page(int uffd, __u64 address, void *dest)
 		return -1;
 	}
 
+	uffd_copied_pages++;
 
 	return uffdio_copy.copy;
 
@@ -357,7 +358,6 @@ static int handle_remaining_pages(int uffd, struct list_head *uffd_list, void *d
 			return -1;
 		}
 
-		uffd_copied_pages++;
 		uffd_pages->flags |= UFFD_FLAG_SENT;
 	}
 
@@ -376,7 +376,6 @@ static int handle_regular_pages(int uffd, struct list_head *uffd_list, void *des
 		return -1;
 	}
 
-	uffd_copied_pages++;
 	/*
 	 * Mark this page as having been already transferred, so
 	 * that it has not to be copied again later.
-- 
1.9.1



More information about the CRIU mailing list