1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00
freebsd/lib
Adrian Chadd 6520495abc Add an initial NUMA affinity/policy configuration for threads and processes.
This is based on work done by jeff@ and jhb@, as well as the numa.diff
patch that has been circulating when someone asks for first-touch NUMA
on -10 or -11.

* Introduce a simple set of VM policy and iterator types.
* tie the policy types into the vm_phys path for now, mirroring how
  the initial first-touch allocation work was enabled.
* add syscalls to control changing thread and process defaults.
* add a global NUMA VM domain policy.
* implement a simple cascade policy order - if a thread policy exists, use it;
  if a process policy exists, use it; use the default policy.
* processes inherit policies from their parent processes, threads inherit
  policies from their parent threads.
* add a simple tool (numactl) to query and modify default thread/process
  policities.
* add documentation for the new syscalls, for numa and for numactl.
* re-enable first touch NUMA again by default, as now policies can be
  set in a variety of methods.

This is only relevant for very specific workloads.

This doesn't pretend to be a final NUMA solution.

The previous defaults in -HEAD (with MAXMEMDOM set) can be achieved by
'sysctl vm.default_policy=rr'.

This is only relevant if MAXMEMDOM is set to something other than 1.
Ie, if you're using GENERIC or a modified kernel with non-NUMA, then
this is a glorified no-op for you.

Thank you to Norse Corp for giving me access to rather large
(for FreeBSD!) NUMA machines in order to develop and verify this.

Thank you to Dell for providing me with dual socket sandybridge
and westmere v3 hardware to do NUMA development with.

Thank you to Scott Long at Netflix for providing me with access
to the two-socket, four-domain haswell v3 hardware.

Thank you to Peter Holm for running the stress testing suite
against the NUMA branch during various stages of development!

Tested:

* MIPS (regression testing; non-NUMA)
* i386 (regression testing; non-NUMA GENERIC)
* amd64 (regression testing; non-NUMA GENERIC)
* westmere, 2 socket (thankyou norse!)
* sandy bridge, 2 socket (thankyou dell!)
* ivy bridge, 2 socket (thankyou norse!)
* westmere-EX, 4 socket / 1TB RAM (thankyou norse!)
* haswell, 2 socket (thankyou norse!)
* haswell v3, 2 socket (thankyou dell)
* haswell v3, 2x18 core (thankyou scott long / netflix!)

* Peter Holm ran a stress test suite on this work and found one
  issue, but has not been able to verify it (it doesn't look NUMA
  related, and he only saw it once over many testing runs.)

* I've tested bhyve instances running in fixed NUMA domains and cpusets;
  all seems to work correctly.

Verified:

* intel-pcm - pcm-numa.x and pcm-memory.x, whilst selecting different
  NUMA policies for processes under test.

Review:

This was reviewed through phabricator (https://reviews.freebsd.org/D2559)
as well as privately and via emails to freebsd-arch@.  The git history
with specific attributes is available at https://github.com/erikarn/freebsd/
in the NUMA branch (https://github.com/erikarn/freebsd/compare/local/adrian_numa_policy).

This has been reviewed by a number of people (stas, rpaulo, kib, ngie,
wblock) but not achieved a clear consensus.  My hope is that with further
exposure and testing more functionality can be implemented and evaluated.

Notes:

* The VM doesn't handle unbalanced domains very well, and if you have an overly
  unbalanced memory setup whilst under high memory pressure, VM page allocation
  may fail leading to a kernel panic.  This was a problem in the past, but it's
  much more easily triggered now with these tools.

* This work only controls the path through vm_phys; it doesn't yet strongly/predictably
  affect contigmalloc, KVA placement, UMA, etc.  So, driver placement of memory
  isn't really guaranteed in any way.  That's next on my plate.

Sponsored by:	Norse Corp, Inc.; Dell
2015-07-11 15:21:37 +00:00
..
atf Add META_MODE support. 2015-06-13 19:20:56 +00:00
clang new depends 2015-06-16 23:37:19 +00:00
csu Force the dynamic linker to resolve _end early so we pick up the correct 2015-07-02 15:02:59 +00:00
libalias Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libarchive Add META_MODE support. 2015-06-13 19:20:56 +00:00
libauditd Add META_MODE support. 2015-06-13 19:20:56 +00:00
libbegemot new depends 2015-06-16 23:37:19 +00:00
libblocksruntime Add META_MODE support. 2015-06-13 19:20:56 +00:00
libbluetooth Add META_MODE support. 2015-06-13 19:20:56 +00:00
libbsdstat
libbsm Add META_MODE support. 2015-06-13 19:20:56 +00:00
libbsnmp Add META_MODE support. 2015-06-13 19:20:56 +00:00
libbz2 Add META_MODE support. 2015-06-13 19:20:56 +00:00
libc Add an initial NUMA affinity/policy configuration for threads and processes. 2015-07-11 15:21:37 +00:00
libc_nonshared Add META_MODE support. 2015-06-13 19:20:56 +00:00
libc++ Add META_MODE support. 2015-06-13 19:20:56 +00:00
libcalendar Add META_MODE support. 2015-06-13 19:20:56 +00:00
libcam Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libcapsicum Let the nv.h and dnv.h includes be only in sys directory. 2015-07-02 21:58:10 +00:00
libcasper Let the nv.h and dnv.h includes be only in sys directory. 2015-07-02 21:58:10 +00:00
libclang_rt Upgrade our copy of clang and llvm to 3.6.1 release. 2015-05-25 13:43:03 +00:00
libcom_err new depends 2015-06-16 23:37:19 +00:00
libcompat Add META_MODE support. 2015-06-13 19:20:56 +00:00
libcompiler_rt Add META_MODE support. 2015-06-13 19:20:56 +00:00
libcrypt new depends 2015-06-16 23:37:19 +00:00
libcuse Add META_MODE support. 2015-06-13 19:20:56 +00:00
libcxxrt Add __cxa_deleted_virtual to libcxxrt's version map. 2015-06-23 17:54:24 +00:00
libdevctl
libdevinfo Add META_MODE support. 2015-06-13 19:20:56 +00:00
libdevstat Add META_MODE support. 2015-06-13 19:20:56 +00:00
libdpv Add META_MODE support. 2015-06-13 19:20:56 +00:00
libdwarf new depends 2015-06-16 23:37:19 +00:00
libedit Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libefi
libelf Add META_MODE support. 2015-06-13 19:20:56 +00:00
libelftc Pay attention to MK_ELFTOOLCHAIN_TOOLS so we build the desired tools. 2015-06-15 20:11:15 +00:00
libevent Add META_MODE support. 2015-06-13 19:20:56 +00:00
libexecinfo Add META_MODE support. 2015-06-13 19:20:56 +00:00
libexpat Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libfetch Remove unused variable to silence clang warning. 2015-07-04 17:22:07 +00:00
libfigpar Add META_MODE support. 2015-06-13 19:20:56 +00:00
libgeom Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libgpib Add META_MODE support. 2015-06-13 19:20:56 +00:00
libgpio Bump .Dd for the example code update. 2015-07-01 16:50:01 +00:00
libgssapi Add META_MODE support. 2015-06-13 19:20:56 +00:00
libiconv_modules Add META_MODE support. 2015-06-13 19:20:56 +00:00
libipsec New AES modes for IPSec, user space components. 2015-07-03 20:09:14 +00:00
libjail Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libkiconv Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libkvm Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libldns new depends 2015-06-16 23:37:19 +00:00
liblzma only enable immintrin when clang is used. The base gcc does not support it. 2015-07-08 18:36:37 +00:00
libmagic new depends 2015-06-16 23:37:19 +00:00
libmd Complete the move that was started w/ r263218.. For some reason I 2015-07-11 03:12:34 +00:00
libmemstat Add META_MODE support. 2015-06-13 19:20:56 +00:00
libmilter Add META_MODE support. 2015-06-13 19:20:56 +00:00
libmp new depends 2015-06-16 23:37:19 +00:00
libmt Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libnandfs
libnetbsd Add META_MODE support. 2015-06-13 19:20:56 +00:00
libnetgraph Add META_MODE support. 2015-06-13 19:20:56 +00:00
libngatm Add META_MODE support. 2015-06-13 19:20:56 +00:00
libnv Move the nvlist source and private includes from sys/kern to seperate 2015-07-04 16:33:37 +00:00
libohash Add META_MODE support. 2015-06-13 19:20:56 +00:00
libopie new depends 2015-06-16 23:37:19 +00:00
libpam new depends 2015-06-16 23:37:19 +00:00
libpcap Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libpjdlog Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libpmc Add META_MODE support. 2015-06-13 19:20:56 +00:00
libproc Make libproc compilable on AArch64. 2015-07-01 13:59:26 +00:00
libprocstat Add META_MODE support. 2015-06-13 19:20:56 +00:00
libradius new depends 2015-06-16 23:37:19 +00:00
librpcsec_gss Add META_MODE support. 2015-06-13 19:20:56 +00:00
librpcsvc Add META_MODE support. 2015-06-13 19:20:56 +00:00
librt Add META_MODE support. 2015-06-13 19:20:56 +00:00
librtld_db Add META_MODE support. 2015-06-13 19:20:56 +00:00
libsbuf new depends 2015-06-16 23:37:19 +00:00
libsdp Add META_MODE support. 2015-06-13 19:20:56 +00:00
libsm libsm/path.c is about to disappear in the merge of sendmail 8.15.2. It is an 2015-07-07 02:35:06 +00:00
libsmb Add META_MODE support. 2015-06-13 19:20:56 +00:00
libsmdb Add META_MODE support. 2015-06-13 19:20:56 +00:00
libsmutil Add META_MODE support. 2015-06-13 19:20:56 +00:00
libsqlite3 Add META_MODE support. 2015-06-13 19:20:56 +00:00
libstand Add META_MODE support. 2015-06-13 19:20:56 +00:00
libstdbuf Add META_MODE support. 2015-06-13 19:20:56 +00:00
libstdthreads Add META_MODE support. 2015-06-13 19:20:56 +00:00
libtacplus Add META_MODE support. 2015-06-13 19:20:56 +00:00
libtelnet Add META_MODE support. 2015-06-13 19:20:56 +00:00
libthr cosmetic: whitespaces-tab before EOL 2015-07-08 16:35:24 +00:00
libthread_db new depends 2015-06-16 23:37:19 +00:00
libucl Add META_MODE support. 2015-06-13 19:20:56 +00:00
libufs Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libugidfw Set some internal helpers as static and initialize few variables to silence 2015-06-24 01:48:44 +00:00
libulog Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
libunbound Add META_MODE support. 2015-06-13 19:20:56 +00:00
libusb Remove unused variables to silence CLANG warnings. 2015-06-24 01:34:35 +00:00
libusbhid Add META_MODE support. 2015-06-13 19:20:56 +00:00
libutil Bump .Dd due to changes made in r285050 and r285053 2015-07-02 19:41:08 +00:00
libvgl Add META_MODE support. 2015-06-13 19:20:56 +00:00
libvmmapi Move the 'devmem' device nodes from /dev/vmm to /dev/vmm.io 2015-07-06 19:41:43 +00:00
libwrap Add META_MODE support. 2015-06-13 19:20:56 +00:00
libxo Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
liby Add META_MODE support. 2015-06-13 19:20:56 +00:00
libypclnt new depends 2015-06-16 23:37:19 +00:00
libz new depends 2015-06-16 23:37:19 +00:00
msun Fix compilation when the armv6 world is being compiled without hw floating 2015-06-24 18:29:34 +00:00
ncurses Install ncurses html documentation again after r284345 2015-06-22 05:41:13 +00:00
tests
Makefile First cut of DTrace for AArch64. 2015-07-01 15:51:11 +00:00
Makefile.inc