[CRIU] [PATCH v2 06/11] uffdd: Read pages directly into destination buffer

Mike Rapoport rppt at linux.vnet.ibm.com
Sun Nov 13 01:52:39 PST 2016


From: Pavel Emelyanov <xemul at virtuozzo.com>

This avoids excessive memcpy() one instruction below.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
Acked-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/uffd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/criu/uffd.c b/criu/uffd.c
index 85d9025..777d18b 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -530,7 +530,6 @@ out:
 static int get_page(struct lazy_pages_info *lpi, unsigned long addr, void *dest)
 {
 	int ret;
-	unsigned char buf[PAGE_SIZE];
 
 	lpi->pr.reset(&lpi->pr);
 
@@ -542,13 +541,11 @@ static int get_page(struct lazy_pages_info *lpi, unsigned long addr, void *dest)
 	if (pagemap_zero(lpi->pr.pe))
 		return 0;
 
-	ret = lpi->pr.read_pages(&lpi->pr, addr, 1, buf);
+	ret = lpi->pr.read_pages(&lpi->pr, addr, 1, dest);
 	pr_debug("read_pages ret %d\n", ret);
 	if (ret <= 0)
 		return ret;
 
-	memcpy(dest, buf, PAGE_SIZE);
-
 	return 1;
 }
 
-- 
1.9.1



More information about the CRIU mailing list