[CRIU] [PATCH 1/3] lazy-pages: merge compete_page_fault into uffd_io_complete

Mike Rapoport rppt at linux.vnet.ibm.com
Mon Jul 24 17:23:19 MSK 2017


There's no real point to have two-liner wrapper for compete_page_fault and
uffd_io_complete is better semantically.

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

diff --git a/criu/uffd.c b/criu/uffd.c
index a94eaaa..606e8cb 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -711,11 +711,14 @@ static int uffd_copy(struct lazy_pages_info *lpi, __u64 address, int nr_pages)
 	return 0;
 }
 
-static int complete_page_fault(struct lazy_pages_info *lpi, unsigned long img_addr, int nr)
+static int uffd_io_complete(struct page_read *pr, unsigned long img_addr, int nr)
 {
+	struct lazy_pages_info *lpi;
 	unsigned long addr = 0;
 	struct lp_req *req;
 
+	lpi = container_of(pr, struct lazy_pages_info, pr);
+
 	list_for_each_entry(req, &lpi->reqs, l) {
 		if (req->img_addr == img_addr) {
 			addr = req->addr;
@@ -741,14 +744,6 @@ static int complete_page_fault(struct lazy_pages_info *lpi, unsigned long img_ad
 	return drop_lazy_iovs(lpi, addr, nr * PAGE_SIZE);
 }
 
-static int uffd_io_complete(struct page_read *pr, unsigned long img_addr, int nr)
-{
-	struct lazy_pages_info *lpi;
-
-	lpi = container_of(pr, struct lazy_pages_info, pr);
-	return complete_page_fault(lpi, img_addr, nr);
-}
-
 static int uffd_zero(struct lazy_pages_info *lpi, __u64 address, int nr_pages)
 {
 	struct uffdio_zeropage uffdio_zeropage;
-- 
2.7.4



More information about the CRIU mailing list