freebsd-skq/lib/libc/tests
markj 094736f08f Provide separate accounting for user-wired pages.
Historically we have not distinguished between kernel wirings and user
wirings for accounting purposes.  User wirings (via mlock(2)) were
subject to a global limit on the number of wired pages, so if large
swaths of physical memory were wired by the kernel, as happens with
the ZFS ARC among other things, the limit could be exceeded, causing
user wirings to fail.

The change adds a new counter, v_user_wire_count, which counts the
number of virtual pages wired by user processes via mlock(2) and
mlockall(2).  Only user-wired pages are subject to the system-wide
limit which helps provide some safety against deadlocks.  In
particular, while sources of kernel wirings typically support some
backpressure mechanism, there is no way to reclaim user-wired pages
shorting of killing the wiring process.  The limit is exported as
vm.max_user_wired, renamed from vm.max_wired, and changed from u_int
to u_long.

The choice to count virtual user-wired pages rather than physical
pages was done for simplicity.  There are mechanisms that can cause
user-wired mappings to be destroyed while maintaining a wiring of
the backing physical page; these make it difficult to accurately
track user wirings at the physical page layer.

The change also closes some holes which allowed user wirings to succeed
even when they would cause the system limit to be exceeded.  For
instance, mmap() may now fail with ENOMEM in a process that has called
mlockall(MCL_FUTURE) if the new mapping would cause the user wiring
limit to be exceeded.

Note that bhyve -S is subject to the user wiring limit, which defaults
to 1/3 of physical RAM.  Users that wish to exceed the limit must tune
vm.max_user_wired.

Reviewed by:	kib, ngie (mlock() test changes)
Tested by:	pho (earlier version)
MFC after:	45 days
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D19908
2019-05-13 16:38:48 +00:00
..
c063 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
db DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
gen Drop "All rights reserved" from my copyright statements. 2019-03-06 22:11:45 +00:00
hash DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
iconv Remove 'All rights reserved' from my files 2018-05-09 20:12:59 +00:00
inet DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
locale DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
net DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
nss DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
regex regcomp: reduce size of bitmap for multibyte locales 2018-12-12 04:23:00 +00:00
resolv DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
rpc DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
setjmp DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
ssp Rework check for libclang_rt to see if the needed library exists. 2018-06-27 16:56:46 +00:00
stdio Conform to Berne Convention. 2018-05-22 06:22:58 +00:00
stdlib Allow users to override CSTD/CXXSTD on a per-prog basis 2019-03-29 18:49:08 +00:00
string DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
sys Provide separate accounting for user-wired pages. 2019-05-13 16:38:48 +00:00
termios DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
time DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
tls DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
tls_dso DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
ttyio DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
Makefile Connect libc/tests/time to the build, adding test cases for strptime() 2018-10-30 02:37:23 +00:00
Makefile.depend DIRDEPS_BUILD: Connect MK_TESTS. 2016-03-09 22:46:01 +00:00
Makefile.netbsd-tests