On Mon, Apr 05, 2021 at 11:13:14PM +0200, Michael Kerrisk (man-pages) wrote: > Hello Alex, Peter, Hi, Michael, [...] > > @@ -144,6 +170,17 @@ single threaded non-cooperative userfaultfd manager implementations. > > .\" and limitations remaining in 4.11 > > .\" Maybe it's worth adding a dedicated sub-section... > > .\" > > +.PP > > +Since Linux 5.7, userfaultfd is able to do > > +synchronous page dirty tracking using the new write-protect register mode. > > +One should check against the feature bit > > +.B UFFD_FEATURE_PAGEFAULT_FLAG_WP > > +before using this feature. > > +Similar to the original userfaultfd missing mode, the write-protect mode will > > +generate an userfaultfd message when the protected page is written. > > +The user needs to resolve the page fault by unprotecting the faulted page and > > You use "user-space" elsewhere, but "the user" here. What is the difference? I wanted to mean the same idea of user-space indeed. > > More generally, What is "the user" in this context? I think you > really mean something like "the trap-handling thread"" or something > like that? The same statement applies for various pieces below. Yes, it's just a more general wording since the trap-handling thread in the userfaultfd world belongs to the user, or the user-space. > > > +kick the faulted thread to continue. > > What does "kick" mean here. This should be explained. Sorry about that, "kick" is a very frequently used wording for developers but probably confusing for manpage readers, it means "wake up". > > > +For more information, please refer to "Userfaultfd write-protect mode" section. > > .SS Userfaultfd operation > > After the userfaultfd object is created with > > .BR userfaultfd (), > > @@ -179,7 +216,7 @@ or > > .BR ioctl (2) > > operations to resolve the page fault. > > .PP > > -Starting from Linux 4.14, if the application sets the > > +Since Linux 4.14, if the application sets the > > .B UFFD_FEATURE_SIGBUS > > feature bit using the > > .B UFFDIO_API > > @@ -219,6 +256,65 @@ userfaultfd can be used only with anonymous private memory mappings. > > Since Linux 4.11, > > userfaultfd can be also used with hugetlbfs and shared memory mappings. > > .\" > > +.SS Userfaultfd write-protect mode (since 5.7) > > +Since Linux 5.7, userfaultfd supports write-protect mode. > > +The user needs to first check availability of this feature using > > +.B UFFDIO_API > > +ioctl against the feature bit > > +.B UFFD_FEATURE_PAGEFAULT_FLAG_WP > > +before using this feature. > > +.PP > > +To register with userfaultfd write-protect mode, the user needs to initiate the > > You use "user-space" elsewhere, but "the user" here. What is the difference? (I'm skipping same questions) [...] > > +.B UFFDIO_REGISTER > > +with the mode set to > > +.BR "UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP" . > > +When there is only > > +.B UFFDIO_REGISTER_MODE_WP > > +registered, the userspace will > > +.I not > > +receive any message when a missing page is written. > > +Instead, the userspace will only receive a write-protect page fault message > > +when an existing but write-protected page got written. > > The wording here is a bit off. What does it mean: "an existing but > write-protected page"? I wanted to emphasize the fact that this write-protect message won't be generated if the page does not exist at all. That belongs to the missing page fault even if a memory write triggerred the page fault. Thanks, -- Peter Xu