mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
page-xfer: Move lazy bool on xfer
Same thing for the boolean value saying whether or not to send lazy pagemaps alone or follow them with the respective pages. This value is non-true in the single place, so let's simplify the API and keep this bool on xfer object. Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
121f07a79f
commit
daf8b4f75c
@@ -1491,7 +1491,7 @@ static int cr_pre_dump_finish(int ret)
|
||||
goto err;
|
||||
|
||||
mem_pp = dmpi(item)->mem_pp;
|
||||
ret = page_xfer_dump_pages(&xfer, mem_pp, true);
|
||||
ret = page_xfer_dump_pages(&xfer, mem_pp);
|
||||
|
||||
xfer.close(&xfer);
|
||||
|
||||
|
@@ -22,6 +22,7 @@ struct page_xfer {
|
||||
* relative to some address. Used, e.g. by shmem.
|
||||
*/
|
||||
unsigned long offset;
|
||||
bool transfer_lazy;
|
||||
|
||||
/* private data for every page-xfer engine */
|
||||
union {
|
||||
@@ -41,7 +42,7 @@ struct page_xfer {
|
||||
|
||||
extern int open_page_xfer(struct page_xfer *xfer, int fd_type, long id);
|
||||
struct page_pipe;
|
||||
extern int page_xfer_dump_pages(struct page_xfer *, struct page_pipe *, bool dump_lazy);
|
||||
extern int page_xfer_dump_pages(struct page_xfer *, struct page_pipe *);
|
||||
extern int connect_to_page_server_to_send(void);
|
||||
extern int connect_to_page_server_to_recv(int epfd);
|
||||
extern int disconnect_from_page_server(void);
|
||||
|
10
criu/mem.c
10
criu/mem.c
@@ -275,7 +275,7 @@ static int drain_pages(struct page_pipe *pp, struct parasite_ctl *ctl,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int xfer_pages(struct page_pipe *pp, struct page_xfer *xfer, bool lazy)
|
||||
static int xfer_pages(struct page_pipe *pp, struct page_xfer *xfer)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -284,7 +284,7 @@ static int xfer_pages(struct page_pipe *pp, struct page_xfer *xfer, bool lazy)
|
||||
* pre-dump action (see pre_dump_one_task)
|
||||
*/
|
||||
timing_start(TIME_MEMWRITE);
|
||||
ret = page_xfer_dump_pages(xfer, pp, !lazy);
|
||||
ret = page_xfer_dump_pages(xfer, pp);
|
||||
timing_stop(TIME_MEMWRITE);
|
||||
|
||||
return ret;
|
||||
@@ -346,6 +346,8 @@ static int __parasite_dump_pages_seized(struct pstree_item *item,
|
||||
ret = open_page_xfer(&xfer, CR_FD_PAGEMAP, vpid(item));
|
||||
if (ret < 0)
|
||||
goto out_pp;
|
||||
|
||||
xfer.transfer_lazy = !mdc->lazy;
|
||||
} else {
|
||||
ret = check_parent_page_xfer(CR_FD_PAGEMAP, vpid(item));
|
||||
if (ret < 0)
|
||||
@@ -387,7 +389,7 @@ again:
|
||||
|
||||
ret = drain_pages(pp, ctl, args);
|
||||
if (!ret)
|
||||
ret = xfer_pages(pp, &xfer, mdc->lazy /* false actually */);
|
||||
ret = xfer_pages(pp, &xfer);
|
||||
if (!ret) {
|
||||
page_pipe_reinit(pp);
|
||||
goto again;
|
||||
@@ -403,7 +405,7 @@ again:
|
||||
sizeof(struct iovec) * pp->nr_iovs);
|
||||
ret = drain_pages(pp, ctl, args);
|
||||
if (!ret && !mdc->pre_dump)
|
||||
ret = xfer_pages(pp, &xfer, mdc->lazy);
|
||||
ret = xfer_pages(pp, &xfer);
|
||||
if (ret)
|
||||
goto out_xfer;
|
||||
|
||||
|
@@ -379,6 +379,7 @@ out:
|
||||
int open_page_xfer(struct page_xfer *xfer, int fd_type, long id)
|
||||
{
|
||||
xfer->offset = 0;
|
||||
xfer->transfer_lazy = true;
|
||||
|
||||
if (opts.use_page_server)
|
||||
return open_page_server_xfer(xfer, fd_type, id);
|
||||
@@ -433,8 +434,7 @@ static int dump_holes(struct page_xfer *xfer, struct page_pipe *pp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
|
||||
bool dump_lazy)
|
||||
int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp)
|
||||
{
|
||||
struct page_pipe_buf *ppb;
|
||||
unsigned int cur_hole = 0;
|
||||
@@ -461,7 +461,7 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
|
||||
(unsigned int)(iov.iov_len / PAGE_SIZE));
|
||||
|
||||
if (ppb->flags & PPB_LAZY) {
|
||||
if (!dump_lazy) {
|
||||
if (!xfer->transfer_lazy) {
|
||||
if (xfer->write_pagemap(xfer, &iov, PE_LAZY))
|
||||
return -1;
|
||||
continue;
|
||||
|
@@ -640,7 +640,7 @@ static int dump_pages(struct page_pipe *pp, struct page_xfer *xfer)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return page_xfer_dump_pages(xfer, pp, true);
|
||||
return page_xfer_dump_pages(xfer, pp);
|
||||
}
|
||||
|
||||
static int next_data_segment(int fd, unsigned long pfn,
|
||||
|
Reference in New Issue
Block a user