mirror of https://github.com/mkerrisk/man-pages
mremap.2: Describe some use cases for MREMAP_DONTUNMAP
Reported-by: Brian Geffon <bgeffon@google.com> Reported-by: Lokesh Gidra <lokeshgidra@google.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
0367239919
commit
a47ce0632c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue