There is a demo code in the userfaultfd() manual page: http://man7.org/linux/man-pages/man2/userfaultfd.2.html