2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

lazy-pages: simplify background transfer logic

First check if there are pages we need to transfer and only afterwards
check if there are outstanding requests. Also, instead checking 'bool
remaining' to see if there is more work to do we can simply check if all
the lpi's have been already serviced.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Mike Rapoport
2018-03-25 16:27:28 +03:00
committed by Andrei Vagin
parent 71a3f9aaee
commit b11f579626

View File

@@ -1092,8 +1092,6 @@ static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds)
int ret;
for (;;) {
bool remaining = false;
ret = epoll_run_rfds(epollfd, events, nr_fds, poll_timeout);
if (ret < 0)
goto out;
@@ -1112,23 +1110,21 @@ static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds)
poll_timeout = 0;
list_for_each_entry_safe(lpi, n, &lpis, l) {
if (list_empty(&lpi->iovs) && list_empty(&lpi->reqs)) {
lazy_pages_summary(lpi);
list_del(&lpi->l);
lpi_fini(lpi);
continue;
}
remaining = true;
if (!list_empty(&lpi->iovs)) {
ret = xfer_pages(lpi);
if (ret < 0)
goto out;
break;
}
if (list_empty(&lpi->reqs)) {
lazy_pages_summary(lpi);
list_del(&lpi->l);
lpi_fini(lpi);
}
}
if (!remaining)
if (list_empty(&lpis))
break;
}