git: kernel - Implement mlockall() properly
Matthew Dillon
dillon at crater.dragonflybsd.org
Thu May 19 10:40:03 PDT 2022
commit c936cb6fb98d3c40c4f9174ee19179e918a2b544
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Thu May 19 10:30:29 2022 -0700
kernel - Implement mlockall() properly
* Implement mlockall()'s MCL_CURRENT, and generalaly reimplement mlockall()
using linux-like expectations. This generally means that the system
will do a best-effort to allocate and lock the memory associated with
the process's address space.
* Prior semantics which disallowed protection changes on locked memory have
been removed. Modern applications assume that protection changes will
work on locked memory, even if it would force a fault.
* As with linux, some license is taken and mlockall() will only force fault
any copy-on-write flagged anonymous pages at the time of the call. It
will not force a copy-on-write operation on unmodified file-backed pages
that have been mapped MAP_PRIVATE, but not yet modified (still represent
the file's actual content). Nor will it force-fault the parent process's
pages when the parent issues a fork() (which forces all anonymous pages in
both the parent and child to become copy-on-write).
Such pages can still take a write-fault and be COWd. The resulting newly
allocated page will be wired as expected.
Submitted-by: tuxillo
Testing-by: tuxillo, dillon
Summary of changes:
lib/libc/sys/mlockall.2 | 39 ++++++++++++++++++++++++++++++++-------
sys/vm/vm_fault.c | 24 +++++++++++++++++-------
sys/vm/vm_map.c | 18 ++++++++++++++----
sys/vm/vm_mmap.c | 33 ++++++++++++++++++++++++++++++---
4 files changed, 93 insertions(+), 21 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/c936cb6fb98d3c40c4f9174ee19179e918a2b544
--
DragonFly BSD source repository
More information about the Commits
mailing list