freebsd-skq/usr.bin
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
..
addr2line new depends 2015-06-16 23:37:19 +00:00
alias Add META_MODE support. 2015-06-13 19:20:56 +00:00
apply Add META_MODE support. 2015-06-13 19:20:56 +00:00
ar speed up ar(1) on UFS file systems 2015-06-29 13:48:44 +00:00
asa Add META_MODE support. 2015-06-13 19:20:56 +00:00
at Add META_MODE support. 2015-06-13 19:20:56 +00:00
atm Add META_MODE support. 2015-06-13 19:20:56 +00:00
awk Add META_MODE support. 2015-06-13 19:20:56 +00:00
banner Add META_MODE support. 2015-06-13 19:20:56 +00:00
basename Add META_MODE support. 2015-06-13 19:20:56 +00:00
bc Add META_MODE support. 2015-06-13 19:20:56 +00:00
biff Add META_MODE support. 2015-06-13 19:20:56 +00:00
bluetooth Add META_MODE support. 2015-06-13 19:20:56 +00:00
bmake new depends 2015-06-16 23:37:19 +00:00
brandelf Add META_MODE support. 2015-06-13 19:20:56 +00:00
bsdiff Add META_MODE support. 2015-06-13 19:20:56 +00:00
bzip2 Add META_MODE support. 2015-06-13 19:20:56 +00:00
bzip2recover Add META_MODE support. 2015-06-13 19:20:56 +00:00
c89 Add META_MODE support. 2015-06-13 19:20:56 +00:00
c99 Add META_MODE support. 2015-06-13 19:20:56 +00:00
calendar Add the year to the VAX-11/780 announcement entry. 2015-07-02 12:08:05 +00:00
cap_mkdb Add META_MODE support. 2015-06-13 19:20:56 +00:00
catman Add META_MODE support. 2015-06-13 19:20:56 +00:00
chat Add META_MODE support. 2015-06-13 19:20:56 +00:00
checknr Add META_MODE support. 2015-06-13 19:20:56 +00:00
chkey Add META_MODE support. 2015-06-13 19:20:56 +00:00
chpass Add META_MODE support. 2015-06-13 19:20:56 +00:00
cksum Add META_MODE support. 2015-06-13 19:20:56 +00:00
clang lldb: use .PATH to find man page instead of symlinking it 2015-07-07 18:46:41 +00:00
cmp Add META_MODE support. 2015-06-13 19:20:56 +00:00
col Add META_MODE support. 2015-06-13 19:20:56 +00:00
colcrt Add META_MODE support. 2015-06-13 19:20:56 +00:00
colldef new depends 2015-06-16 23:37:19 +00:00
colrm Add META_MODE support. 2015-06-13 19:20:56 +00:00
column Add META_MODE support. 2015-06-13 19:20:56 +00:00
comm Add META_MODE support. 2015-06-13 19:20:56 +00:00
compile_et Add META_MODE support. 2015-06-13 19:20:56 +00:00
compress Add META_MODE support. 2015-06-13 19:20:56 +00:00
cpio Add META_MODE support. 2015-06-13 19:20:56 +00:00
cpuset Add META_MODE support. 2015-06-13 19:20:56 +00:00
csplit Add META_MODE support. 2015-06-13 19:20:56 +00:00
ctags Add META_MODE support. 2015-06-13 19:20:56 +00:00
ctlstat Add META_MODE support. 2015-06-13 19:20:56 +00:00
cut Add META_MODE support. 2015-06-13 19:20:56 +00:00
cxxfilt Actually add c++filt's Makefile 2015-04-30 22:51:15 +00:00
dc Add META_MODE support. 2015-06-13 19:20:56 +00:00
dirname Add META_MODE support. 2015-06-13 19:20:56 +00:00
dpv
drill
dtc
du Add META_MODE support. 2015-06-13 19:20:56 +00:00
ee new depends 2015-06-16 23:37:19 +00:00
elf2aout Add META_MODE support. 2015-06-13 19:20:56 +00:00
elfcopy new depends 2015-06-16 23:37:19 +00:00
elfdump Add META_MODE support. 2015-06-13 19:20:56 +00:00
enigma Add META_MODE support. 2015-06-13 19:20:56 +00:00
env Add META_MODE support. 2015-06-13 19:20:56 +00:00
expand Add META_MODE support. 2015-06-13 19:20:56 +00:00
false Add META_MODE support. 2015-06-13 19:20:56 +00:00
fetch Add META_MODE support. 2015-06-13 19:20:56 +00:00
file Add META_MODE support. 2015-06-13 19:20:56 +00:00
file2c Add META_MODE support. 2015-06-13 19:20:56 +00:00
find new depends 2015-06-16 23:37:19 +00:00
finger Add META_MODE support. 2015-06-13 19:20:56 +00:00
fmt Add META_MODE support. 2015-06-13 19:20:56 +00:00
fold Add META_MODE support. 2015-06-13 19:20:56 +00:00
from Add META_MODE support. 2015-06-13 19:20:56 +00:00
fstat Add META_MODE support. 2015-06-13 19:20:56 +00:00
fsync Add META_MODE support. 2015-06-13 19:20:56 +00:00
ftp Add META_MODE support. 2015-06-13 19:20:56 +00:00
gcore Add META_MODE support. 2015-06-13 19:20:56 +00:00
gencat Add META_MODE support. 2015-06-13 19:20:56 +00:00
getconf new depends 2015-06-16 23:37:19 +00:00
getent Add META_MODE support. 2015-06-13 19:20:56 +00:00
getopt Add META_MODE support. 2015-06-13 19:20:56 +00:00
gprof Add META_MODE support. 2015-06-13 19:20:56 +00:00
grep new depends 2015-06-16 23:37:19 +00:00
gzip Add META_MODE support. 2015-06-13 19:20:56 +00:00
head Add META_MODE support. 2015-06-13 19:20:56 +00:00
hesinfo
hexdump Add META_MODE support. 2015-06-13 19:20:56 +00:00
host Add META_MODE support. 2015-06-13 19:20:56 +00:00
iconv Remove the const qualifier from iconv(3) to comply with POSIX: 2015-04-15 09:09:20 +00:00
id Add META_MODE support. 2015-06-13 19:20:56 +00:00
indent Add META_MODE support. 2015-06-13 19:20:56 +00:00
ipcrm Add META_MODE support. 2015-06-13 19:20:56 +00:00
ipcs Add META_MODE support. 2015-06-13 19:20:56 +00:00
iscsictl Add libxo(3) support to iscsictl(8). 2015-04-12 09:36:50 +00:00
join Add META_MODE support. 2015-06-13 19:20:56 +00:00
jot Add META_MODE support. 2015-06-13 19:20:56 +00:00
kdump Let the nv.h and dnv.h includes be only in sys directory. 2015-07-02 21:58:10 +00:00
keylogin Add META_MODE support. 2015-06-13 19:20:56 +00:00
keylogout Add META_MODE support. 2015-06-13 19:20:56 +00:00
killall Add META_MODE support. 2015-06-13 19:20:56 +00:00
ktrace Add META_MODE support. 2015-06-13 19:20:56 +00:00
ktrdump Add META_MODE support. 2015-06-13 19:20:56 +00:00
lam Add META_MODE support. 2015-06-13 19:20:56 +00:00
last Add META_MODE support. 2015-06-13 19:20:56 +00:00
lastcomm Add META_MODE support. 2015-06-13 19:20:56 +00:00
ldd Add META_MODE support. 2015-06-13 19:20:56 +00:00
leave Add META_MODE support. 2015-06-13 19:20:56 +00:00
less new depends 2015-06-16 23:37:19 +00:00
lessecho new depends 2015-06-16 23:37:19 +00:00
lesskey new depends 2015-06-16 23:37:19 +00:00
lex Add META_MODE support. 2015-06-13 19:20:56 +00:00
limits Add META_MODE support. 2015-06-13 19:20:56 +00:00
locale Add META_MODE support. 2015-06-13 19:20:56 +00:00
locate Add META_MODE support. 2015-06-13 19:20:56 +00:00
lock Add META_MODE support. 2015-06-13 19:20:56 +00:00
lockf Add META_MODE support. 2015-06-13 19:20:56 +00:00
logger Add META_MODE support. 2015-06-13 19:20:56 +00:00
login Add META_MODE support. 2015-06-13 19:20:56 +00:00
logins Add META_MODE support. 2015-06-13 19:20:56 +00:00
logname Add META_MODE support. 2015-06-13 19:20:56 +00:00
look Add META_MODE support. 2015-06-13 19:20:56 +00:00
lorder Add META_MODE support. 2015-06-13 19:20:56 +00:00
lsvfs Add META_MODE support. 2015-06-13 19:20:56 +00:00
lzmainfo Add META_MODE support. 2015-06-13 19:20:56 +00:00
m4 Add META_MODE support. 2015-06-13 19:20:56 +00:00
mail Add META_MODE support. 2015-06-13 19:20:56 +00:00
makewhatis Add META_MODE support. 2015-06-13 19:20:56 +00:00
man Add META_MODE support. 2015-06-13 19:20:56 +00:00
mandoc new depends 2015-06-16 23:37:19 +00:00
mesg Add META_MODE support. 2015-06-13 19:20:56 +00:00
minigzip Add META_MODE support. 2015-06-13 19:20:56 +00:00
ministat Add META_MODE support. 2015-06-13 19:20:56 +00:00
mkcsmapper
mkcsmapper_static NO_WARNS when building for host 2015-06-14 03:34:09 +00:00
mkdep Add META_MODE support. 2015-06-13 19:20:56 +00:00
mkesdb The LDFLAGS isn't needed, and breaks the build on powerpc64. 2015-06-30 06:02:42 +00:00
mkesdb_static NO_WARNS when building for host 2015-06-14 03:34:09 +00:00
mkfifo Add META_MODE support. 2015-06-13 19:20:56 +00:00
mkimg Add the ntfs alias and support it with the MBR and GPT schemes 2015-06-27 03:28:04 +00:00
mklocale new depends 2015-06-16 23:37:19 +00:00
mkstr Add META_MODE support. 2015-06-13 19:20:56 +00:00
mktemp Add META_MODE support. 2015-06-13 19:20:56 +00:00
mkulzma Add META_MODE support. 2015-06-13 19:20:56 +00:00
mkuzip Add META_MODE support. 2015-06-13 19:20:56 +00:00
msgs Add META_MODE support. 2015-06-13 19:20:56 +00:00
mt Add META_MODE support. 2015-06-13 19:20:56 +00:00
nc Add META_MODE support. 2015-06-13 19:20:56 +00:00
ncal Add META_MODE support. 2015-06-13 19:20:56 +00:00
netstat New AES modes for IPSec, user space components. 2015-07-03 20:09:14 +00:00
newgrp Add META_MODE support. 2015-06-13 19:20:56 +00:00
newkey Add META_MODE support. 2015-06-13 19:20:56 +00:00
nfsstat Add META_MODE support. 2015-06-13 19:20:56 +00:00
nice Add META_MODE support. 2015-06-13 19:20:56 +00:00
nl Add META_MODE support. 2015-06-13 19:20:56 +00:00
nm new depends 2015-06-16 23:37:19 +00:00
nohup Add META_MODE support. 2015-06-13 19:20:56 +00:00
numactl Add an initial NUMA affinity/policy configuration for threads and processes. 2015-07-11 15:21:37 +00:00
opieinfo Add META_MODE support. 2015-06-13 19:20:56 +00:00
opiekey Add META_MODE support. 2015-06-13 19:20:56 +00:00
opiepasswd Add META_MODE support. 2015-06-13 19:20:56 +00:00
pagesize Add META_MODE support. 2015-06-13 19:20:56 +00:00
pamtest Add META_MODE support. 2015-06-13 19:20:56 +00:00
passwd Add META_MODE support. 2015-06-13 19:20:56 +00:00
paste Add META_MODE support. 2015-06-13 19:20:56 +00:00
patch patch(1): small include changes. 2015-04-20 22:15:18 +00:00
pathchk Add META_MODE support. 2015-06-13 19:20:56 +00:00
perror Add META_MODE support. 2015-06-13 19:20:56 +00:00
pr Add META_MODE support. 2015-06-13 19:20:56 +00:00
printenv Add META_MODE support. 2015-06-13 19:20:56 +00:00
printf Add META_MODE support. 2015-06-13 19:20:56 +00:00
procstat Add META_MODE support. 2015-06-13 19:20:56 +00:00
protect Reassign copyright statements on several files from Advanced 2015-04-23 14:22:20 +00:00
quota - Add IPv6 support in quota(1). While rpc.rquotad has supported PF_INET6 2015-07-07 20:15:09 +00:00
rctl Add META_MODE support. 2015-06-13 19:20:56 +00:00
readelf new depends 2015-06-16 23:37:19 +00:00
renice Add META_MODE support. 2015-06-13 19:20:56 +00:00
rev Add META_MODE support. 2015-06-13 19:20:56 +00:00
revoke Add META_MODE support. 2015-06-13 19:20:56 +00:00
rlogin Add META_MODE support. 2015-06-13 19:20:56 +00:00
rpcgen Add META_MODE support. 2015-06-13 19:20:56 +00:00
rpcinfo Add META_MODE support. 2015-06-13 19:20:56 +00:00
rs Add META_MODE support. 2015-06-13 19:20:56 +00:00
rsh Add META_MODE support. 2015-06-13 19:20:56 +00:00
rup Add META_MODE support. 2015-06-13 19:20:56 +00:00
ruptime Add META_MODE support. 2015-06-13 19:20:56 +00:00
rusers Add META_MODE support. 2015-06-13 19:20:56 +00:00
rwall Add META_MODE support. 2015-06-13 19:20:56 +00:00
rwho Add META_MODE support. 2015-06-13 19:20:56 +00:00
script Add META_MODE support. 2015-06-13 19:20:56 +00:00
sed Add META_MODE support. 2015-06-13 19:20:56 +00:00
send-pr
seq Add META_MODE support. 2015-06-13 19:20:56 +00:00
setchannel Add META_MODE support. 2015-06-13 19:20:56 +00:00
shar Add META_MODE support. 2015-06-13 19:20:56 +00:00
showmount Add META_MODE support. 2015-06-13 19:20:56 +00:00
size new depends 2015-06-16 23:37:19 +00:00
smbutil Add META_MODE support. 2015-06-13 19:20:56 +00:00
sockstat - Add SOCK_SEQPACKET support in UNIX-domain socket. 2015-06-20 08:59:50 +00:00
soelim * fix roff terminology in .Nd 2015-05-21 08:28:48 +00:00
sort new depends 2015-06-16 23:37:19 +00:00
split Add META_MODE support. 2015-06-13 19:20:56 +00:00
ssh-copy-id Add META_MODE support. 2015-06-13 19:20:56 +00:00
stat Add META_MODE support. 2015-06-13 19:20:56 +00:00
stdbuf Add META_MODE support. 2015-06-13 19:20:56 +00:00
strings new depends 2015-06-16 23:37:19 +00:00
su Add META_MODE support. 2015-06-13 19:20:56 +00:00
svn Add META_MODE support. 2015-06-13 19:20:56 +00:00
systat Add META_MODE support. 2015-06-13 19:20:56 +00:00
tabs Add META_MODE support. 2015-06-13 19:20:56 +00:00
tail Add META_MODE support. 2015-06-13 19:20:56 +00:00
talk Add META_MODE support. 2015-06-13 19:20:56 +00:00
tar Add META_MODE support. 2015-06-13 19:20:56 +00:00
tcopy Add META_MODE support. 2015-06-13 19:20:56 +00:00
tee Add META_MODE support. 2015-06-13 19:20:56 +00:00
telnet Add META_MODE support. 2015-06-13 19:20:56 +00:00
tests
tftp Add META_MODE support. 2015-06-13 19:20:56 +00:00
time Add META_MODE support. 2015-06-13 19:20:56 +00:00
timeout Add META_MODE support. 2015-06-13 19:20:56 +00:00
tip Add META_MODE support. 2015-06-13 19:20:56 +00:00
top new depends 2015-06-16 23:37:19 +00:00
touch Add META_MODE support. 2015-06-13 19:20:56 +00:00
tput Add META_MODE support. 2015-06-13 19:20:56 +00:00
tr Add META_MODE support. 2015-06-13 19:20:56 +00:00
true Add META_MODE support. 2015-06-13 19:20:56 +00:00
truncate Add META_MODE support. 2015-06-13 19:20:56 +00:00
truss new depends 2015-06-16 23:37:19 +00:00
tset Add META_MODE support. 2015-06-13 19:20:56 +00:00
tsort Add META_MODE support. 2015-06-13 19:20:56 +00:00
tty Add META_MODE support. 2015-06-13 19:20:56 +00:00
ul Add META_MODE support. 2015-06-13 19:20:56 +00:00
uname Add META_MODE support. 2015-06-13 19:20:56 +00:00
unexpand Add META_MODE support. 2015-06-13 19:20:56 +00:00
unifdef Add META_MODE support. 2015-06-13 19:20:56 +00:00
uniq Add META_MODE support. 2015-06-13 19:20:56 +00:00
units Only initialize libedit when necessary 2015-06-28 16:43:07 +00:00
unvis Add META_MODE support. 2015-06-13 19:20:56 +00:00
unzip Add META_MODE support. 2015-06-13 19:20:56 +00:00
usbhidaction Add META_MODE support. 2015-06-13 19:20:56 +00:00
usbhidctl Add META_MODE support. 2015-06-13 19:20:56 +00:00
users Add META_MODE support. 2015-06-13 19:20:56 +00:00
uudecode Add META_MODE support. 2015-06-13 19:20:56 +00:00
uuencode Add META_MODE support. 2015-06-13 19:20:56 +00:00
vacation Add META_MODE support. 2015-06-13 19:20:56 +00:00
vgrind Add META_MODE support. 2015-06-13 19:20:56 +00:00
vi Add META_MODE support. 2015-06-13 19:20:56 +00:00
vis Add META_MODE support. 2015-06-13 19:20:56 +00:00
vmstat Add META_MODE support. 2015-06-13 19:20:56 +00:00
vtfontcvt Add META_MODE support. 2015-06-13 19:20:56 +00:00
w Add META_MODE support. 2015-06-13 19:20:56 +00:00
wall Add META_MODE support. 2015-06-13 19:20:56 +00:00
wc Add META_MODE support. 2015-06-13 19:20:56 +00:00
what Add META_MODE support. 2015-06-13 19:20:56 +00:00
whereis Add META_MODE support. 2015-06-13 19:20:56 +00:00
which Add META_MODE support. 2015-06-13 19:20:56 +00:00
who Add META_MODE support. 2015-06-13 19:20:56 +00:00
whois Add META_MODE support. 2015-06-13 19:20:56 +00:00
write Add META_MODE support. 2015-06-13 19:20:56 +00:00
xargs Add META_MODE support. 2015-06-13 19:20:56 +00:00
xinstall short circuit install -l rs 2015-06-26 23:55:02 +00:00
xlint new depends 2015-06-16 23:37:19 +00:00
xo
xstr Add META_MODE support. 2015-06-13 19:20:56 +00:00
xz Add META_MODE support. 2015-06-13 19:20:56 +00:00
xzdec Add META_MODE support. 2015-06-13 19:20:56 +00:00
yacc Add META_MODE support. 2015-06-13 19:20:56 +00:00
yes Add META_MODE support. 2015-06-13 19:20:56 +00:00
ypcat Add META_MODE support. 2015-06-13 19:20:56 +00:00
ypmatch Add META_MODE support. 2015-06-13 19:20:56 +00:00
ypwhich Add META_MODE support. 2015-06-13 19:20:56 +00:00
Makefile Add an initial NUMA affinity/policy configuration for threads and processes. 2015-07-11 15:21:37 +00:00
Makefile.amd64
Makefile.arm
Makefile.i386
Makefile.inc
Makefile.powerpc
Makefile.sparc64