[CRIU] [RFC PATCH v2 00/23] lazy-pages: add non-#PF events handling

Mike Rapoport rppt at linux.vnet.ibm.com
Mon Feb 6 03:43:53 PST 2017


Hi,

These patches add handling of userfaultfd events other than page fault.
Some required kernel patches are in -mm tree for a while now, but there
were also last minute updates merged only last week.
The kernel provides now userfaultfd events for fork(), exit(), mremap(),
munmap(), madvise(MADV_DONTNEED) and madvise(MADV_REMOVE) system calls.
The patches below use these events to detect changes in the restored
process virtual memory layout and take an appropriate action in the
lazy-pages daemon.

There still some gaps left:
* There maybe races between unmap events and #PF completion. We'll need to
enhance error processing in uffd_copy to cope with those
* fork() event is still not handled properly for remote-lazy-pages case.
* I've added quite an overhead for #PF handling because of lookups in
lazy_iov list. To reduce the lookup overhead we can split the lazy_iov list
into several lists, per-VMA, or use rbtree instead of list or both
* The issues I missed :)

Mike Rapoport (23):
  lazy-pages: drop code for page fault message flags processing
  lazy-pages: track outstanding page faults
  lazy-pages: s/lazy_iovec/lazy_iov/g
  lazy-pages: use iov variable name for lazy_iov
  lazy-pages: use lazy_iov'ecs to search for pages
  lazy-pages: introduce lp_{debug,info,warn,err,perror} helper macros
  lazy-pages: rename update_lazy_iovs to drop_lazy_iovs
  lazy-pages: update drop_lazy_iovs to handle addresses outside IOVs
  lazy-pages: start handling remaining pages if IOVs list is not empty
  lazy-pages: summary: allow different total and copied pages
  Update criu/include/linux/userfaultfd.h
  cr-check: lazy-pages: detect availability of UNMAP and EXIT events
  lazy-pages: add handling of UFFD_EVENT_REMOVE
  lazy-pages: add handling of UFFD_EVENT_UNMAP
  lazy-pages: introduce split_iov
  lazy-pages: add handling of UFFD_EVENT_REMAP
  page-read: add PID for some debug printouts
  page-read: introduce dup_page_read
  util: introduce epoll_del_rfd
  lazy-pages: handle UFFD_EVENT_EXIT
  lazy-pages: add handling of UFFD_EVENT_FORK
  lazy-pages: request userfaultfd events during API handshake
  test: add basic test for uffd events

 criu/cr-check.c                  |   4 +-
 criu/include/linux/userfaultfd.h |  60 +++--
 criu/include/pagemap.h           |   7 +
 criu/include/util.h              |   1 +
 criu/pagemap.c                   |  25 +-
 criu/uffd.c                      | 499 +++++++++++++++++++++++++++++++--------
 criu/util.c                      |  10 +
 test/zdtm/static/Makefile        |   1 +
 test/zdtm/static/uffd-events.c   | 188 +++++++++++++++
 9 files changed, 676 insertions(+), 119 deletions(-)
 create mode 100644 test/zdtm/static/uffd-events.c

-- 
1.9.1



More information about the CRIU mailing list