mirror of https://github.com/mkerrisk/man-pages
mremap.2: Document MREMAP_DONTUNMAP
Signed-off-by: Brian Geffon <bgeffon@google.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
cb76d6e5fe
commit
8debc4f595
|
@ -130,6 +130,22 @@ If
|
||||||
is specified, then
|
is specified, then
|
||||||
.B MREMAP_MAYMOVE
|
.B MREMAP_MAYMOVE
|
||||||
must also be specified.
|
must also be specified.
|
||||||
|
.TP
|
||||||
|
.BR MREMAP_DONTUNMAP " (since Linux 5.7)"
|
||||||
|
.\" commit e346b3813067d4b17383f975f197a9aa28a3b077
|
||||||
|
This flag which must be used in conjunction with
|
||||||
|
.B MREMAP_MAYMOVE
|
||||||
|
remaps a mapping to a new address and it does not unmap the mapping at
|
||||||
|
.BR old_address .
|
||||||
|
This flag can only be used with private anonymous mappings.
|
||||||
|
Any access to the range specified at
|
||||||
|
.BR old_address
|
||||||
|
after completion will result in an anonymous page fault.
|
||||||
|
The anonymous page fault will be handled by a
|
||||||
|
.BR userfaultfd (2)
|
||||||
|
if the range was previously registered on the mapping specified by
|
||||||
|
.BR old_address .
|
||||||
|
Otherwise, it will be zero filled by the kernel.
|
||||||
.PP
|
.PP
|
||||||
If the memory segment specified by
|
If the memory segment specified by
|
||||||
.I old_address
|
.I old_address
|
||||||
|
@ -177,6 +193,8 @@ a value other than
|
||||||
.B MREMAP_MAYMOVE
|
.B MREMAP_MAYMOVE
|
||||||
or
|
or
|
||||||
.B MREMAP_FIXED
|
.B MREMAP_FIXED
|
||||||
|
or
|
||||||
|
.B MREMAP_DONTUNMAP
|
||||||
was specified in
|
was specified in
|
||||||
.IR flags ;
|
.IR flags ;
|
||||||
.IP *
|
.IP *
|
||||||
|
@ -198,9 +216,22 @@ and
|
||||||
.IR old_size ;
|
.IR old_size ;
|
||||||
.IP *
|
.IP *
|
||||||
.B MREMAP_FIXED
|
.B MREMAP_FIXED
|
||||||
|
or
|
||||||
|
.B MREMAP_DONTUNMAP
|
||||||
was specified without also specifying
|
was specified without also specifying
|
||||||
.BR MREMAP_MAYMOVE ;
|
.BR MREMAP_MAYMOVE ;
|
||||||
.IP *
|
.IP *
|
||||||
|
.B MREMAP_DONTUNMAP
|
||||||
|
was specified with and
|
||||||
|
.BR old_address
|
||||||
|
that was not private anonymous;
|
||||||
|
.IP *
|
||||||
|
.B MREMAP_DONTUNMAP
|
||||||
|
was specified and
|
||||||
|
.BR old_size
|
||||||
|
was not equal to
|
||||||
|
.BR new_size ;
|
||||||
|
.IP *
|
||||||
\fIold_size\fP was zero and \fIold_address\fP does not refer to a
|
\fIold_size\fP was zero and \fIold_address\fP does not refer to a
|
||||||
shareable mapping (but see BUGS);
|
shareable mapping (but see BUGS);
|
||||||
.IP *
|
.IP *
|
||||||
|
@ -210,10 +241,20 @@ flag was not specified.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B ENOMEM
|
.B ENOMEM
|
||||||
|
Not enough memory was available to complete the operation.
|
||||||
|
Possible causes are:
|
||||||
|
.RS
|
||||||
|
.IP * 3
|
||||||
The memory area cannot be expanded at the current virtual address, and the
|
The memory area cannot be expanded at the current virtual address, and the
|
||||||
.B MREMAP_MAYMOVE
|
.B MREMAP_MAYMOVE
|
||||||
flag is not set in \fIflags\fP.
|
flag is not set in \fIflags\fP.
|
||||||
Or, there is not enough (virtual) memory available.
|
Or, there is not enough (virtual) memory available.
|
||||||
|
.IP *
|
||||||
|
.B MREMAP_DONTUNMAP
|
||||||
|
was used causing a new mapping to be created that would exceed the
|
||||||
|
(virtual) memory available.
|
||||||
|
Or, it would exceed the maximum number of allowed mappings.
|
||||||
|
.RE
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
This call is Linux-specific, and should not be used in programs
|
This call is Linux-specific, and should not be used in programs
|
||||||
intended to be portable.
|
intended to be portable.
|
||||||
|
@ -239,6 +280,14 @@ call will make a best effort to populate the new area but will not fail
|
||||||
with
|
with
|
||||||
.B ENOMEM
|
.B ENOMEM
|
||||||
if the area cannot be populated.
|
if the area cannot be populated.
|
||||||
|
.PP
|
||||||
|
The
|
||||||
|
.BR MREMAP_DONTUNMAP
|
||||||
|
flag may be used to atomically move a mapping while leaving the source
|
||||||
|
mapped.
|
||||||
|
Possible applications for this behavior might be garbage collection or
|
||||||
|
non-cooperative
|
||||||
|
.BR userfaultfd (2) .
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
Before Linux 4.14,
|
Before Linux 4.14,
|
||||||
if
|
if
|
||||||
|
|
Loading…
Reference in New Issue