mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +00:00
uffd: Unify page handling in normal and remaining modes (v2)
This run away from previous set :) Two routines are now identical, only page-read flags differ. v2: Keep the uffd_hanle_pages() name travis-ci: success for Some more cleanups over uffd.c (rev3) Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
This commit is contained in:
parent
e82f03e1eb
commit
12c0f452fe
25
criu/uffd.c
25
criu/uffd.c
@ -619,7 +619,7 @@ static int uffd_seek_or_zero_pages(struct lazy_pages_info *lpi, __u64 address,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int uffd_handle_pages(struct lazy_pages_info *lpi, __u64 address, int nr)
|
||||
static int uffd_handle_pages(struct lazy_pages_info *lpi, __u64 address, int nr, unsigned flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -627,7 +627,7 @@ static int uffd_handle_pages(struct lazy_pages_info *lpi, __u64 address, int nr)
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
|
||||
ret = lpi->pr.read_pages(&lpi->pr, address, nr, lpi->buf, 0);
|
||||
ret = lpi->pr.read_pages(&lpi->pr, address, nr, lpi->buf, flags);
|
||||
if (ret <= 0) {
|
||||
pr_err("%d: failed reading pages at %llx\n", lpi->pid, address);
|
||||
return ret;
|
||||
@ -648,7 +648,7 @@ static int handle_remaining_pages(struct lazy_pages_info *lpi)
|
||||
list_for_each_entry(lazy_iov, &lpi->iovs, l) {
|
||||
nr_pages = lazy_iov->len / PAGE_SIZE;
|
||||
|
||||
err = uffd_handle_pages(lpi, lazy_iov->base, nr_pages);
|
||||
err = uffd_handle_pages(lpi, lazy_iov->base, nr_pages, 0);
|
||||
if (err < 0) {
|
||||
pr_err("Error during UFFD copy\n");
|
||||
return -1;
|
||||
@ -658,23 +658,6 @@ static int handle_remaining_pages(struct lazy_pages_info *lpi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_page_fault(struct lazy_pages_info *lpi, __u64 address, int nr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = uffd_seek_or_zero_pages(lpi, address, nr);
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
|
||||
ret = lpi->pr.read_pages(&lpi->pr, address, nr, lpi->buf, PR_ASYNC | PR_ASAP);
|
||||
if (ret <= 0) {
|
||||
pr_err("%d: failed reading pages at %llx\n", lpi->pid, address);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_user_fault(struct lazy_pages_fd *lpfd)
|
||||
{
|
||||
struct lazy_pages_info *lpi;
|
||||
@ -720,7 +703,7 @@ static int handle_user_fault(struct lazy_pages_fd *lpfd)
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = handle_page_fault(lpi, address, 1);
|
||||
ret = uffd_handle_pages(lpi, address, 1, PR_ASYNC | PR_ASAP);
|
||||
if (ret < 0) {
|
||||
pr_err("Error during regular page copy\n");
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user