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.\" 256520495aSAdrian Chadd.\" $FreeBSD$ 266520495aSAdrian Chadd.\" 27b61f3142SMark Johnston.Dd October 22, 2018 286520495aSAdrian Chadd.Dt NUMA 4 296520495aSAdrian Chadd.Os 306520495aSAdrian Chadd.Sh NAME 316520495aSAdrian Chadd.Nm NUMA 326520495aSAdrian Chadd.Nd Non-Uniform Memory Access 336520495aSAdrian Chadd.Sh SYNOPSIS 34b61f3142SMark Johnston.Cd options MAXMEMDOM 35b61f3142SMark Johnston.Cd options NUMA 366520495aSAdrian Chadd.Pp 376520495aSAdrian Chadd.Sh DESCRIPTION 386520495aSAdrian ChaddNon-Uniform Memory Access is a computer architecture design which 396520495aSAdrian Chaddinvolves unequal costs between processors, memory and IO devices 406520495aSAdrian Chaddin a given system. 416520495aSAdrian Chadd.Pp 426520495aSAdrian ChaddIn a 436520495aSAdrian Chadd.Nm 446520495aSAdrian Chaddarchitecture, the latency to access specific memory or IO devices 456520495aSAdrian Chadddepends upon which processor the memory or device is attached to. 466520495aSAdrian ChaddAccessing memory local to a processor is faster than accessing memory 476520495aSAdrian Chaddthat is connected to one of the other processors. 48b61f3142SMark Johnston.Fx 49b61f3142SMark Johnstonimplements NUMA-aware memory allocation policies. 50b61f3142SMark JohnstonBy default it attempts to ensure that allocations are balanced across 51b61f3142SMark Johnstoneach domain. 52b61f3142SMark JohnstonUsers may override the default domain selection policy using 53b61f3142SMark Johnston.Xr cpuset 1 . 546520495aSAdrian Chadd.Pp 556520495aSAdrian Chadd.Nm 56b61f3142SMark Johnstonsupport is enabled when the 57b3042426SKonstantin Belousov.Cd NUMA 58b61f3142SMark Johnstonoption is specified in the kernel configuration file. 59b61f3142SMark JohnstonEach platform defines the 60b3042426SKonstantin Belousov.Cd MAXMEMDOM 61b61f3142SMark Johnstonconstant, which specifies the maximum number of supported NUMA domains. 62b61f3142SMark JohnstonThis constant may be specified in the kernel configuration file. 63b61f3142SMark Johnston.Nm 64b61f3142SMark Johnstonsupport can be disabled at boot time by setting the 65b61f3142SMark Johnston.Va vm.numa.disabled 66b61f3142SMark Johnstontunable to 1. 67b61f3142SMark JohnstonOther values for this tunable are currently ignored. 686520495aSAdrian Chadd.Pp 696520495aSAdrian ChaddThread and process 706520495aSAdrian Chadd.Nm 716520495aSAdrian Chaddpolicies are controlled with the 72b3042426SKonstantin Belousov.Xr cpuset_getdomain 2 736520495aSAdrian Chaddand 74b3042426SKonstantin Belousov.Xr cpuset_setdomain 2 756520495aSAdrian Chaddsyscalls. 766520495aSAdrian ChaddThe 77b3042426SKonstantin Belousov.Xr cpuset 1 786520495aSAdrian Chaddtool is available for starting processes with a non-default 796520495aSAdrian Chaddpolicy, or to change the policy of an existing thread or process. 80*50619ae7SPoul-Henning KampSee 81*50619ae7SPoul-Henning Kamp.Xr SMP 4 82*50619ae7SPoul-Henning Kampfor information about CPU to domain mapping. 836520495aSAdrian Chadd.Pp 846520495aSAdrian ChaddSystems with non-uniform access to I/O devices may mark those devices 856520495aSAdrian Chaddwith the local VM domain identifier. 866520495aSAdrian ChaddDrivers can find out their local domain information by calling 876520495aSAdrian Chadd.Xr bus_get_domain 9 . 886520495aSAdrian Chadd.Ss MIB Variables 896520495aSAdrian ChaddThe operation of 906520495aSAdrian Chadd.Nm 916520495aSAdrian Chaddis controlled and exposes information with these 926520495aSAdrian Chadd.Xr sysctl 8 936520495aSAdrian ChaddMIB variables: 946520495aSAdrian Chadd.Pp 956520495aSAdrian Chadd.Bl -tag -width indent -compact 966520495aSAdrian Chadd.It Va vm.ndomains 976520495aSAdrian ChaddThe number of VM domains which have been detected. 986520495aSAdrian Chadd.Pp 996520495aSAdrian Chadd.It Va vm.phys_locality 1006520495aSAdrian ChaddA table indicating the relative cost of each VM domain to each other. 1016520495aSAdrian ChaddA value of 10 indicates equal cost. 1026520495aSAdrian ChaddA value of -1 means the locality map is not available or no 1036520495aSAdrian Chaddlocality information is available. 1046520495aSAdrian Chadd.Pp 1056520495aSAdrian Chadd.It Va vm.phys_segs 1066520495aSAdrian ChaddThe map of physical memory, grouped by VM domain. 1076520495aSAdrian Chadd.El 1086520495aSAdrian Chadd.Sh IMPLEMENTATION NOTES 1096520495aSAdrian ChaddThe current 1106520495aSAdrian Chadd.Nm 1116520495aSAdrian Chaddimplementation is VM-focused. 1126520495aSAdrian ChaddThe hardware 1136520495aSAdrian Chadd.Nm 1146520495aSAdrian Chadddomains are mapped into a contiguous, non-sparse 1156520495aSAdrian ChaddVM domain space, starting from 0. 1166520495aSAdrian ChaddThus, VM domain information (for example, the domain identifier) is not 1176520495aSAdrian Chaddnecessarily the same as is found in the hardware specific information. 1186520495aSAdrian ChaddPolicy information is available in both struct thread and struct proc. 1196520495aSAdrian Chadd.Sh SEE ALSO 120b3042426SKonstantin Belousov.Xr cpuset 1 , 121b3042426SKonstantin Belousov.Xr cpuset_getaffinity 2 , 122b3042426SKonstantin Belousov.Xr cpuset_setaffinity 2 , 123*50619ae7SPoul-Henning Kamp.Xr SMP 4 , 1246520495aSAdrian Chadd.Xr bus_get_domain 9 1256520495aSAdrian Chadd.Sh HISTORY 1266520495aSAdrian Chadd.Nm 1276520495aSAdrian Chaddfirst appeared in 1286520495aSAdrian Chadd.Fx 9.0 1296520495aSAdrian Chaddas a first-touch allocation policy with a fail-over to round-robin allocation 1306520495aSAdrian Chaddand was not configurable. 1316520495aSAdrian ChaddIt was then modified in 1326520495aSAdrian Chadd.Fx 10.0 1336520495aSAdrian Chaddto implement a round-robin allocation policy and was also not configurable. 1346520495aSAdrian Chadd.Pp 1356520495aSAdrian ChaddThe 1366520495aSAdrian Chadd.Xr numa_getaffinity 2 1376520495aSAdrian Chaddand 1386520495aSAdrian Chadd.Xr numa_setaffinity 2 139b3042426SKonstantin Belousovsyscalls and the 1406520495aSAdrian Chadd.Xr numactl 1 1416520495aSAdrian Chaddtool first appeared in 142b3042426SKonstantin Belousov.Fx 11.0 143b3042426SKonstantin Belousovand were removed in 144b3042426SKonstantin Belousov.Fx 12.0 . 145b61f3142SMark JohnstonThe current implementation appeared in 146b3042426SKonstantin Belousov.Fx 12.0 . 147b3042426SKonstantin Belousov.Pp 1486520495aSAdrian Chadd.Sh AUTHORS 1496520495aSAdrian ChaddThis manual page written by 1506520495aSAdrian Chadd.An Adrian Chadd Aq Mt adrian@FreeBSD.org . 1516520495aSAdrian Chadd.Sh NOTES 1526520495aSAdrian ChaddNo statistics are kept to indicate how often 1536520495aSAdrian Chadd.Nm 1546520495aSAdrian Chaddallocation policies succeed or fail. 155