Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/mlockall.2
Show All 24 Lines | |||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
.\" POSSIBILITY OF SUCH DAMAGE. | .\" POSSIBILITY OF SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd December 25, 2012 | .Dd April 8, 2019 | ||||
.Dt MLOCKALL 2 | .Dt MLOCKALL 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm mlockall , | .Nm mlockall , | ||||
.Nm munlockall | .Nm munlockall | ||||
.Nd lock (unlock) the address space of a process | .Nd lock (unlock) the address space of a process | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
Show All 22 Lines | |||||
cause resource limits to be exceeded. | cause resource limits to be exceeded. | ||||
.El | .El | ||||
.Pp | .Pp | ||||
Since physical memory is a potentially scarce resource, processes are | Since physical memory is a potentially scarce resource, processes are | ||||
limited in how much they can lock down. | limited in how much they can lock down. | ||||
A single process can lock the minimum of a system-wide | A single process can lock the minimum of a system-wide | ||||
.Dq wired pages | .Dq wired pages | ||||
limit | limit | ||||
.Va vm.max_wired | .Va vm.max_user_wired | ||||
and the per-process | and the per-process | ||||
.Dv RLIMIT_MEMLOCK | .Dv RLIMIT_MEMLOCK | ||||
resource limit. | resource limit. | ||||
.Pp | .Pp | ||||
If | If | ||||
.Va security.bsd.unprivileged_mlock | .Va security.bsd.unprivileged_mlock | ||||
is set to 0 these calls are only available to the super-user. | is set to 0 these calls are only available to the super-user. | ||||
If | If | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
.Sh HISTORY | .Sh HISTORY | ||||
The | The | ||||
.Fn mlockall | .Fn mlockall | ||||
and | and | ||||
.Fn munlockall | .Fn munlockall | ||||
functions first appeared in | functions first appeared in | ||||
.Fx 5.1 . | .Fx 5.1 . | ||||
.Sh BUGS | .Sh BUGS | ||||
The per-process resource limit is a limit on the amount of virtual | The per-process and system-wide resource limits of locked memory apply | ||||
memory locked, while the system-wide limit is for the number of locked | to the amount of virtual memory locked, not the amount of locked physical | ||||
physical pages. | pages. | ||||
Hence a process with two distinct locked mappings of the same physical page | Hence two distinct locked mappings of the same physical page counts as | ||||
counts as 2 pages against the per-process limit and as only a single page | 2 pages aginst the system limit, and also against the per-process limit | ||||
in the system limit. | if both mappings belong to the same physical map. |