diff --git a/man2/mremap.2 b/man2/mremap.2 index f82f39d7e..c3055e10d 100644 --- a/man2/mremap.2 +++ b/man2/mremap.2 @@ -145,9 +145,8 @@ The .BR MREMAP_DONTUNMAP flag may be used to atomically move a mapping while leaving the source mapped. -Possible applications for this behavior include garbage collection and -non-cooperative -.BR userfaultfd (2). +See NOTES for some possible applications of +.BR MREMAP_DONTUNMAP . .PP If the memory segment specified by .I old_address @@ -305,6 +304,33 @@ and the prototype for did not allow for the .I new_address argument. +.\" +.SS MREMAP_DONTUNMAP use cases +Possible applications for +.BR MREMAP_DONTUNMAP +include: +.IP * 3 +Non-cooperative +.BR userfaultfd (2): +an application can yank out a virtual address range using +.BR MREMAP_DONTUNMAP +and then employ a +.BR userfaultfd (2) +handler to handle the page faults that subsequently occur +as other threads in the process touch pages in the yanked range. +.IP * +Garbage collection: +.BR MREMAP_DONTUNMAP +can be used in conjunction with +.BR userfaultfd (2) +to implement garbage collection algorithms (e.g., in a Java virtual machine). +Such an implementation can be cheaper (and simpler) +than conventional garbage collection techniques that involve +marking pages with protection +.BR PROT_NONE +in conjunction with the of a +.BR SIGSEGV +handler to catch accesses to those pages. .SH BUGS Before Linux 4.14, if