16520495aSAdrian Chadd.\" Copyright (c) 2015 Adrian Chadd <adrian@FreeBSD.org> 26520495aSAdrian Chadd.\" All rights reserved. 36520495aSAdrian Chadd.\" 46520495aSAdrian Chadd.\" Redistribution and use in source and binary forms, with or without 56520495aSAdrian Chadd.\" modification, are permitted provided that the following conditions 66520495aSAdrian Chadd.\" are met: 76520495aSAdrian Chadd.\" 1. Redistributions of source code must retain the above copyright 86520495aSAdrian Chadd.\" notice, this list of conditions and the following disclaimer. 96520495aSAdrian Chadd.\" 2. Redistributions in binary form must reproduce the above copyright 106520495aSAdrian Chadd.\" notice, this list of conditions and the following disclaimer in the 116520495aSAdrian Chadd.\" documentation and/or other materials provided with the distribution. 126520495aSAdrian Chadd.\" 136520495aSAdrian Chadd.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 146520495aSAdrian Chadd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 156520495aSAdrian Chadd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 166520495aSAdrian Chadd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 176520495aSAdrian Chadd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 186520495aSAdrian Chadd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 196520495aSAdrian Chadd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 206520495aSAdrian Chadd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 216520495aSAdrian Chadd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 226520495aSAdrian Chadd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 236520495aSAdrian Chadd.\" SUCH DAMAGE. 246520495aSAdrian Chadd.\" 25b61f3142SMark Johnston.Dd October 22, 2018 266520495aSAdrian Chadd.Dt NUMA 4 276520495aSAdrian Chadd.Os 286520495aSAdrian Chadd.Sh NAME 296520495aSAdrian Chadd.Nm NUMA 306520495aSAdrian Chadd.Nd Non-Uniform Memory Access 316520495aSAdrian Chadd.Sh SYNOPSIS 32b61f3142SMark Johnston.Cd options MAXMEMDOM 33b61f3142SMark Johnston.Cd options NUMA 346520495aSAdrian Chadd.Sh DESCRIPTION 356520495aSAdrian ChaddNon-Uniform Memory Access is a computer architecture design which 366520495aSAdrian Chaddinvolves unequal costs between processors, memory and IO devices 376520495aSAdrian Chaddin a given system. 386520495aSAdrian Chadd.Pp 396520495aSAdrian ChaddIn a 406520495aSAdrian Chadd.Nm 416520495aSAdrian Chaddarchitecture, the latency to access specific memory or IO devices 426520495aSAdrian Chadddepends upon which processor the memory or device is attached to. 436520495aSAdrian ChaddAccessing memory local to a processor is faster than accessing memory 446520495aSAdrian Chaddthat is connected to one of the other processors. 45b61f3142SMark Johnston.Fx 46b61f3142SMark Johnstonimplements NUMA-aware memory allocation policies. 47b61f3142SMark JohnstonBy default it attempts to ensure that allocations are balanced across 48b61f3142SMark Johnstoneach domain. 49b61f3142SMark JohnstonUsers may override the default domain selection policy using 50b61f3142SMark Johnston.Xr cpuset 1 . 516520495aSAdrian Chadd.Pp 526520495aSAdrian Chadd.Nm 53b61f3142SMark Johnstonsupport is enabled when the 54b3042426SKonstantin Belousov.Cd NUMA 55b61f3142SMark Johnstonoption is specified in the kernel configuration file. 56b61f3142SMark JohnstonEach platform defines the 57b3042426SKonstantin Belousov.Cd MAXMEMDOM 58b61f3142SMark Johnstonconstant, which specifies the maximum number of supported NUMA domains. 59b61f3142SMark JohnstonThis constant may be specified in the kernel configuration file. 60b61f3142SMark Johnston.Nm 61b61f3142SMark Johnstonsupport can be disabled at boot time by setting the 62b61f3142SMark Johnston.Va vm.numa.disabled 63b61f3142SMark Johnstontunable to 1. 64b61f3142SMark JohnstonOther values for this tunable are currently ignored. 656520495aSAdrian Chadd.Pp 666520495aSAdrian ChaddThread and process 676520495aSAdrian Chadd.Nm 686520495aSAdrian Chaddpolicies are controlled with the 69b3042426SKonstantin Belousov.Xr cpuset_getdomain 2 706520495aSAdrian Chaddand 71b3042426SKonstantin Belousov.Xr cpuset_setdomain 2 726520495aSAdrian Chaddsyscalls. 736520495aSAdrian ChaddThe 74b3042426SKonstantin Belousov.Xr cpuset 1 756520495aSAdrian Chaddtool is available for starting processes with a non-default 766520495aSAdrian Chaddpolicy, or to change the policy of an existing thread or process. 77*50619ae7SPoul-Henning KampSee 78*50619ae7SPoul-Henning Kamp.Xr SMP 4 79*50619ae7SPoul-Henning Kampfor information about CPU to domain mapping. 806520495aSAdrian Chadd.Pp 816520495aSAdrian ChaddSystems with non-uniform access to I/O devices may mark those devices 826520495aSAdrian Chaddwith the local VM domain identifier. 836520495aSAdrian ChaddDrivers can find out their local domain information by calling 846520495aSAdrian Chadd.Xr bus_get_domain 9 . 856520495aSAdrian Chadd.Ss MIB Variables 866520495aSAdrian ChaddThe operation of 876520495aSAdrian Chadd.Nm 886520495aSAdrian Chaddis controlled and exposes information with these 896520495aSAdrian Chadd.Xr sysctl 8 906520495aSAdrian ChaddMIB variables: 916520495aSAdrian Chadd.Pp 926520495aSAdrian Chadd.Bl -tag -width indent -compact 936520495aSAdrian Chadd.It Va vm.ndomains 946520495aSAdrian ChaddThe number of VM domains which have been detected. 956520495aSAdrian Chadd.Pp 966520495aSAdrian Chadd.It Va vm.phys_locality 976520495aSAdrian ChaddA table indicating the relative cost of each VM domain to each other. 986520495aSAdrian ChaddA value of 10 indicates equal cost. 996520495aSAdrian ChaddA value of -1 means the locality map is not available or no 1006520495aSAdrian Chaddlocality information is available. 1016520495aSAdrian Chadd.Pp 1026520495aSAdrian Chadd.It Va vm.phys_segs 1036520495aSAdrian ChaddThe map of physical memory, grouped by VM domain. 1046520495aSAdrian Chadd.El 1056520495aSAdrian Chadd.Sh IMPLEMENTATION NOTES 1066520495aSAdrian ChaddThe current 1076520495aSAdrian Chadd.Nm 1086520495aSAdrian Chaddimplementation is VM-focused. 1096520495aSAdrian ChaddThe hardware 1106520495aSAdrian Chadd.Nm 1116520495aSAdrian Chadddomains are mapped into a contiguous, non-sparse 1126520495aSAdrian ChaddVM domain space, starting from 0. 1136520495aSAdrian ChaddThus, VM domain information (for example, the domain identifier) is not 1146520495aSAdrian Chaddnecessarily the same as is found in the hardware specific information. 1156520495aSAdrian ChaddPolicy information is available in both struct thread and struct proc. 1166520495aSAdrian Chadd.Sh SEE ALSO 117b3042426SKonstantin Belousov.Xr cpuset 1 , 118b3042426SKonstantin Belousov.Xr cpuset_getaffinity 2 , 119b3042426SKonstantin Belousov.Xr cpuset_setaffinity 2 , 120*50619ae7SPoul-Henning Kamp.Xr SMP 4 , 1216520495aSAdrian Chadd.Xr bus_get_domain 9 1226520495aSAdrian Chadd.Sh HISTORY 1236520495aSAdrian Chadd.Nm 1246520495aSAdrian Chaddfirst appeared in 1256520495aSAdrian Chadd.Fx 9.0 1266520495aSAdrian Chaddas a first-touch allocation policy with a fail-over to round-robin allocation 1276520495aSAdrian Chaddand was not configurable. 1286520495aSAdrian ChaddIt was then modified in 1296520495aSAdrian Chadd.Fx 10.0 1306520495aSAdrian Chaddto implement a round-robin allocation policy and was also not configurable. 1316520495aSAdrian Chadd.Pp 1326520495aSAdrian ChaddThe 1336520495aSAdrian Chadd.Xr numa_getaffinity 2 1346520495aSAdrian Chaddand 1356520495aSAdrian Chadd.Xr numa_setaffinity 2 136b3042426SKonstantin Belousovsyscalls and the 1376520495aSAdrian Chadd.Xr numactl 1 1386520495aSAdrian Chaddtool first appeared in 139b3042426SKonstantin Belousov.Fx 11.0 140b3042426SKonstantin Belousovand were removed in 141b3042426SKonstantin Belousov.Fx 12.0 . 142b61f3142SMark JohnstonThe current implementation appeared in 143b3042426SKonstantin Belousov.Fx 12.0 . 1446520495aSAdrian Chadd.Sh AUTHORS 1456520495aSAdrian ChaddThis manual page written by 1466520495aSAdrian Chadd.An Adrian Chadd Aq Mt adrian@FreeBSD.org . 1476520495aSAdrian Chadd.Sh NOTES 1486520495aSAdrian ChaddNo statistics are kept to indicate how often 1496520495aSAdrian Chadd.Nm 1506520495aSAdrian Chaddallocation policies succeed or fail. 151