[CRIU] [PATCH v4 07/12] criu: page-xfer: add ability to skip writing lazy pages

Mike Rapoport mike.rapoport at gmail.com
Thu Jun 9 06:12:02 PDT 2016


On Thu, Jun 9, 2016 at 3:59 PM, Pavel Emelyanov <xemul at virtuozzo.com> wrote:
> On 06/06/2016 09:27 AM, Mike Rapoport wrote:
>> Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
>> ---
>>  criu/cr-dump.c           | 2 +-
>>  criu/include/page-xfer.h | 2 +-
>>  criu/mem.c               | 2 +-
>>  criu/page-xfer.c         | 4 +++-
>>  criu/shmem.c             | 2 +-
>>  5 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/criu/cr-dump.c b/criu/cr-dump.c
>> index 6648dd4..2d529fd 100644
>> --- a/criu/cr-dump.c
>> +++ b/criu/cr-dump.c
>> @@ -1430,7 +1430,7 @@ static int cr_pre_dump_finish(struct list_head *ctls, int ret)
>>               if (ret < 0)
>>                       goto err;
>>
>> -             ret = page_xfer_dump_pages(&xfer, ctl->mem_pp, 0);
>> +             ret = page_xfer_dump_pages(&xfer, ctl->mem_pp, 0, true);
>>
>>               xfer.close(&xfer);
>>
>> diff --git a/criu/include/page-xfer.h b/criu/include/page-xfer.h
>> index 8492daa..fb222c3 100644
>> --- a/criu/include/page-xfer.h
>> +++ b/criu/include/page-xfer.h
>> @@ -38,7 +38,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 *,
>> -                             unsigned long off);
>> +                             unsigned long off, bool dump_lazy);
>>  extern int connect_to_page_server(void);
>>  extern int disconnect_from_page_server(void);
>>
>> diff --git a/criu/mem.c b/criu/mem.c
>> index a44ad69..66ca227 100644
>> --- a/criu/mem.c
>> +++ b/criu/mem.c
>> @@ -254,7 +254,7 @@ static int dump_pages(struct page_pipe *pp, struct parasite_ctl *ctl,
>>        */
>>       if (xfer) {
>>               timing_start(TIME_MEMWRITE);
>> -             ret = page_xfer_dump_pages(xfer, pp, 0);
>> +             ret = page_xfer_dump_pages(xfer, pp, 0, true);
>>               timing_stop(TIME_MEMWRITE);
>>       }
>>
>> diff --git a/criu/page-xfer.c b/criu/page-xfer.c
>> index 6561b0a..786516e 100644
>> --- a/criu/page-xfer.c
>> +++ b/criu/page-xfer.c
>> @@ -321,7 +321,7 @@ int open_page_xfer(struct page_xfer *xfer, int fd_type, long id)
>>  }
>>
>>  int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
>> -             unsigned long off)
>> +                      unsigned long off, bool dump_lazy)
>>  {
>>       struct page_pipe_buf *ppb;
>>       struct iovec *hole = NULL;
>> @@ -359,6 +359,8 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
>>
>>                       if (xfer->write_pagemap(xfer, iov))
>>                               return -1;
>> +                     if (!dump_lazy && ppb->flags & PPB_LAZY)
>> +                             continue;
>
> I have a question here -- if page_xfer_dump_pages sends a pagemap the receiver
> would expect the subsequent pages on the socket, but instead, it _may_ receive
> next pagemap if the previous one was lazy. How it this handled?

Hmmm. It is not... I think that page-server and, most probably,
incremental dumps are not compatible with lazy-pages...

>>                       if (xfer->write_pages(xfer, ppb->p[0], iov->iov_len))
>>                               return -1;
>>               }
>> diff --git a/criu/shmem.c b/criu/shmem.c
>> index d9dd405..19d5339 100644
>> --- a/criu/shmem.c
>> +++ b/criu/shmem.c
>> @@ -539,7 +539,7 @@ static int dump_pages(struct page_pipe *pp, struct page_xfer *xfer, void *addr)
>>                       return -1;
>>               }
>>
>> -     return page_xfer_dump_pages(xfer, pp, (unsigned long)addr);
>> +     return page_xfer_dump_pages(xfer, pp, (unsigned long)addr, true);
>>  }
>>
>>  static int dump_one_shmem(struct shmem_info *si)
>>
>



-- 
Sincerely yours,
Mike.


More information about the CRIU mailing list