xref: /freebsd/share/man/man4/numa.4 (revision bc7512cc58af2e8bbe5bbf5ca0059b1daa1da897)
1.\" Copyright (c) 2015 Adrian Chadd <adrian@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd October 22, 2018
28.Dt NUMA 4
29.Os
30.Sh NAME
31.Nm NUMA
32.Nd Non-Uniform Memory Access
33.Sh SYNOPSIS
34.Cd options MAXMEMDOM
35.Cd options NUMA
36.Sh DESCRIPTION
37Non-Uniform Memory Access is a computer architecture design which
38involves unequal costs between processors, memory and IO devices
39in a given system.
40.Pp
41In a
42.Nm
43architecture, the latency to access specific memory or IO devices
44depends upon which processor the memory or device is attached to.
45Accessing memory local to a processor is faster than accessing memory
46that is connected to one of the other processors.
47.Fx
48implements NUMA-aware memory allocation policies.
49By default it attempts to ensure that allocations are balanced across
50each domain.
51Users may override the default domain selection policy using
52.Xr cpuset 1 .
53.Pp
54.Nm
55support is enabled when the
56.Cd NUMA
57option is specified in the kernel configuration file.
58Each platform defines the
59.Cd MAXMEMDOM
60constant, which specifies the maximum number of supported NUMA domains.
61This constant may be specified in the kernel configuration file.
62.Nm
63support can be disabled at boot time by setting the
64.Va vm.numa.disabled
65tunable to 1.
66Other values for this tunable are currently ignored.
67.Pp
68Thread and process
69.Nm
70policies are controlled with the
71.Xr cpuset_getdomain 2
72and
73.Xr cpuset_setdomain 2
74syscalls.
75The
76.Xr cpuset 1
77tool is available for starting processes with a non-default
78policy, or to change the policy of an existing thread or process.
79See
80.Xr SMP 4
81for information about CPU to domain mapping.
82.Pp
83Systems with non-uniform access to I/O devices may mark those devices
84with the local VM domain identifier.
85Drivers can find out their local domain information by calling
86.Xr bus_get_domain 9 .
87.Ss MIB Variables
88The operation of
89.Nm
90is controlled and exposes information with these
91.Xr sysctl 8
92MIB variables:
93.Pp
94.Bl -tag -width indent -compact
95.It Va vm.ndomains
96The number of VM domains which have been detected.
97.Pp
98.It Va vm.phys_locality
99A table indicating the relative cost of each VM domain to each other.
100A value of 10 indicates equal cost.
101A value of -1 means the locality map is not available or no
102locality information is available.
103.Pp
104.It Va vm.phys_segs
105The map of physical memory, grouped by VM domain.
106.El
107.Sh IMPLEMENTATION NOTES
108The current
109.Nm
110implementation is VM-focused.
111The hardware
112.Nm
113domains are mapped into a contiguous, non-sparse
114VM domain space, starting from 0.
115Thus, VM domain information (for example, the domain identifier) is not
116necessarily the same as is found in the hardware specific information.
117Policy information is available in both struct thread and struct proc.
118.Sh SEE ALSO
119.Xr cpuset 1 ,
120.Xr cpuset_getaffinity 2 ,
121.Xr cpuset_setaffinity 2 ,
122.Xr SMP 4 ,
123.Xr bus_get_domain 9
124.Sh HISTORY
125.Nm
126first appeared in
127.Fx 9.0
128as a first-touch allocation policy with a fail-over to round-robin allocation
129and was not configurable.
130It was then modified in
131.Fx 10.0
132to implement a round-robin allocation policy and was also not configurable.
133.Pp
134The
135.Xr numa_getaffinity 2
136and
137.Xr numa_setaffinity 2
138syscalls and the
139.Xr numactl 1
140tool first appeared in
141.Fx 11.0
142and were removed in
143.Fx 12.0 .
144The current implementation appeared in
145.Fx 12.0 .
146.Sh AUTHORS
147This manual page written by
148.An Adrian Chadd Aq Mt adrian@FreeBSD.org .
149.Sh NOTES
150No statistics are kept to indicate how often
151.Nm
152allocation policies succeed or fail.
153