[CRIU] [PATCH] criu: lazy-pages: reduce amount of page_read resets
Mike Rapoport
rppt at linux.vnet.ibm.com
Tue Jun 28 22:15:31 PDT 2016
xemul: reset the pr _only_ if the requesting address is below the recently
read one
Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
criu/uffd.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/criu/uffd.c b/criu/uffd.c
index 1e0a57a..a826e26 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -331,9 +331,15 @@ out:
static int get_page(struct lazy_pages_info *lpi, unsigned long addr, void *dest)
{
int ret;
+ struct iovec iov;
unsigned char buf[PAGE_SIZE];
- lpi->pr.reset(&lpi->pr);
+ ret = lpi->pr.get_pagemap(&lpi->pr, &iov);
+ if (ret <= 0)
+ return ret;
+
+ if (addr < (unsigned long)iov.iov_base)
+ lpi->pr.reset(&lpi->pr);
ret = lpi->pr.seek_page(&lpi->pr, addr, true);
pr_debug("seek_pagemap_page ret 0x%x\n", ret);
@@ -345,6 +351,8 @@ static int get_page(struct lazy_pages_info *lpi, unsigned long addr, void *dest)
if (ret <= 0)
return ret;
+ lpi->pr.put_pagemap(&lpi->pr);
+
memcpy(dest, buf, PAGE_SIZE);
return 1;
@@ -616,6 +624,8 @@ static int find_vmas(struct lazy_pages_info *lpi)
}
} while (ret);
+ lpi->pr.reset(&lpi->pr);
+
/* Count detected pages */
list_for_each_entry(uffd_pages, &lpi->pages, list)
ret++;
--
1.9.1
More information about the CRIU
mailing list