[CRIU] [PATCH 02/10] uffdd: Read pages directly into destination buffer

Pavel Emelyanov xemul at virtuozzo.com
Fri Nov 11 21:23:46 PST 2016


This avoids excessive memcpy() one instruction below.

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

diff --git a/criu/uffd.c b/criu/uffd.c
index 3472e7d..4ee37fa 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -381,7 +381,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);
 
@@ -393,13 +392,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;
 }
 
-- 
2.5.0



More information about the CRIU mailing list