• Mike Rapoport's avatar
    criu: lazy-pages: enable remoting of lazy pages · 5ad71a89
    Mike Rapoport authored
    The remote lazy pages variant can be run as follows:
    
    src# criu dump -t <pid> --lazy-pages --port 9876 -D /tmp/1 &
    src# while ! sudo fuser 9876/tcp ; do sleep 1; done
    src# scp -r /tmp/1/ dst:/tmp/
    
    dst# criu lazy-pages --page-server --address dst --port 9876 -D /tmp/1 &
    dst# criu restore --lazy-pages -D /tmp/1
    
    In a nutshell, this implementation of remote lazy pages does the following:
    
    - dump collects the process memory into the pipes, transfers non-lazy pages
      to the images or to the page-server on the restore side. The lazy pages
      are kept in pipes for later transfer
    - when the dump creates the page_pipe_bufs, it marks the buffers containing
    potentially lazy pages with PPB_LAZY
    - at the dump_finish stage, the dump side starts TCP server that will
    handle page requests from the restore side
    - the checkpoint directory is transferred to the restore side
    - on the restore side lazy-pages daemon is started, it creates UNIX socket
    to receive uffd's from the restore and a TCP socket to forward page
    requests to the dump side
    - restore creates memory mappings and fills the VMAs that cannot be handled
    by uffd with the contents of the pages*img.
    - restore registers lazy VMAs with uffd and sends the userfault file
    descriptors to the lazy-pages daemon
    - when a #PF occurs, the lazy-pages daemon sends PS_IOV_GET command to the dump
    side; the command contains PID, the faulting address and amount of pages
    (always 1 at the moment)
    - the dump side extracts the requested pages from the pipe and splices them
    into the TCP socket.
    - the lazy-pages daemon copies the received pages into the restored process
    address space
    Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    5ad71a89
cr-dump.c 38.2 KB