2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

uffdd: Read pages directly into destination buffer

This avoids excessive memcpy() one instruction below.

travis-ci: success for uffd: A set of improvements over criu/uffd.c
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
This commit is contained in:
Pavel Emelyanov
2016-11-12 08:23:00 +03:00
committed by Andrei Vagin
parent 82c8229100
commit 345b4e77ef

View File

@@ -380,7 +380,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);
@@ -392,13 +391,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, 0);
ret = lpi->pr.read_pages(&lpi->pr, addr, 1, dest, 0);
pr_debug("read_pages ret %d\n", ret);
if (ret <= 0)
return ret;
memcpy(dest, buf, PAGE_SIZE);
return 1;
}