xref: /freebsd/share/man/man4/numa.4 (revision 6520495abc109aa5af083b7cde70e4cf9c338de0)
1*6520495aSAdrian Chadd.\" Copyright (c) 2015 Adrian Chadd <adrian@FreeBSD.org>
2*6520495aSAdrian Chadd.\" All rights reserved.
3*6520495aSAdrian Chadd.\"
4*6520495aSAdrian Chadd.\" Redistribution and use in source and binary forms, with or without
5*6520495aSAdrian Chadd.\" modification, are permitted provided that the following conditions
6*6520495aSAdrian Chadd.\" are met:
7*6520495aSAdrian Chadd.\" 1. Redistributions of source code must retain the above copyright
8*6520495aSAdrian Chadd.\"    notice, this list of conditions and the following disclaimer.
9*6520495aSAdrian Chadd.\" 2. Redistributions in binary form must reproduce the above copyright
10*6520495aSAdrian Chadd.\"    notice, this list of conditions and the following disclaimer in the
11*6520495aSAdrian Chadd.\"    documentation and/or other materials provided with the distribution.
12*6520495aSAdrian Chadd.\"
13*6520495aSAdrian Chadd.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14*6520495aSAdrian Chadd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*6520495aSAdrian Chadd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*6520495aSAdrian Chadd.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17*6520495aSAdrian Chadd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*6520495aSAdrian Chadd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*6520495aSAdrian Chadd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*6520495aSAdrian Chadd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*6520495aSAdrian Chadd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*6520495aSAdrian Chadd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*6520495aSAdrian Chadd.\" SUCH DAMAGE.
24*6520495aSAdrian Chadd.\"
25*6520495aSAdrian Chadd.\" $FreeBSD$
26*6520495aSAdrian Chadd.\"
27*6520495aSAdrian Chadd.Dd May 10, 2015
28*6520495aSAdrian Chadd.Dt NUMA 4
29*6520495aSAdrian Chadd.Os
30*6520495aSAdrian Chadd.Sh NAME
31*6520495aSAdrian Chadd.Nm NUMA
32*6520495aSAdrian Chadd.Nd Non-Uniform Memory Access
33*6520495aSAdrian Chadd.Sh SYNOPSIS
34*6520495aSAdrian Chadd.Cd options SMP
35*6520495aSAdrian Chadd.Cd options MAXMEMDOM=16
36*6520495aSAdrian Chadd.Pp
37*6520495aSAdrian Chadd.In sys/numa.h
38*6520495aSAdrian Chadd.In sys/cpuset.h
39*6520495aSAdrian Chadd.In sys/bus.h
40*6520495aSAdrian Chadd.Sh DESCRIPTION
41*6520495aSAdrian ChaddNon-Uniform Memory Access is a computer architecture design which
42*6520495aSAdrian Chaddinvolves unequal costs between processors, memory and IO devices
43*6520495aSAdrian Chaddin a given system.
44*6520495aSAdrian Chadd.Pp
45*6520495aSAdrian ChaddIn a
46*6520495aSAdrian Chadd.Nm
47*6520495aSAdrian Chaddarchitecture, the latency to access specific memory or IO devices
48*6520495aSAdrian Chadddepends upon which processor the memory or device is attached to.
49*6520495aSAdrian ChaddAccessing memory local to a processor is faster than accessing memory
50*6520495aSAdrian Chaddthat is connected to one of the other processors.
51*6520495aSAdrian Chadd.Pp
52*6520495aSAdrian Chadd.Nm
53*6520495aSAdrian Chaddis enabled when the
54*6520495aSAdrian Chadd.Cd MAXMEMDOM
55*6520495aSAdrian Chaddoption is used in a kernel configuration
56*6520495aSAdrian Chaddfile and is set to a value greater than 1.
57*6520495aSAdrian Chadd.Pp
58*6520495aSAdrian ChaddThread and process
59*6520495aSAdrian Chadd.Nm
60*6520495aSAdrian Chaddpolicies are controlled with the
61*6520495aSAdrian Chadd.Xr numa_setaffinity 2
62*6520495aSAdrian Chaddand
63*6520495aSAdrian Chadd.Xr numa_getaffinity 2
64*6520495aSAdrian Chaddsyscalls.
65*6520495aSAdrian Chadd.Pp
66*6520495aSAdrian ChaddThe
67*6520495aSAdrian Chadd.Xr numactl 1
68*6520495aSAdrian Chaddtool is available for starting processes with a non-default
69*6520495aSAdrian Chaddpolicy, or to change the policy of an existing thread or process.
70*6520495aSAdrian Chadd.Pp
71*6520495aSAdrian ChaddSystems with non-uniform access to I/O devices may mark those devices
72*6520495aSAdrian Chaddwith the local VM domain identifier.
73*6520495aSAdrian ChaddDrivers can find out their local domain information by calling
74*6520495aSAdrian Chadd.Xr bus_get_domain 9 .
75*6520495aSAdrian Chadd.Ss MIB Variables
76*6520495aSAdrian ChaddThe operation of
77*6520495aSAdrian Chadd.Nm
78*6520495aSAdrian Chaddis controlled and exposes information with these
79*6520495aSAdrian Chadd.Xr sysctl 8
80*6520495aSAdrian ChaddMIB variables:
81*6520495aSAdrian Chadd.Pp
82*6520495aSAdrian Chadd.Bl -tag -width indent -compact
83*6520495aSAdrian Chadd.It Va vm.ndomains
84*6520495aSAdrian ChaddThe number of VM domains which have been detected.
85*6520495aSAdrian Chadd.Pp
86*6520495aSAdrian Chadd.It Va vm.default_policy
87*6520495aSAdrian ChaddThe default VM domain allocation policy.
88*6520495aSAdrian ChaddDefaults to "first-touch-rr".
89*6520495aSAdrian ChaddThe valid values are "first-touch", "first-touch-rr",
90*6520495aSAdrian Chadd"rr", where "rr" is a short-hand for "round-robin."
91*6520495aSAdrian ChaddSee
92*6520495aSAdrian Chadd.Xr numa_setaffinity 2
93*6520495aSAdrian Chaddfor more information about the available policies.
94*6520495aSAdrian Chadd.Pp
95*6520495aSAdrian Chadd.It Va vm.phys_locality
96*6520495aSAdrian ChaddA table indicating the relative cost of each VM domain to each other.
97*6520495aSAdrian ChaddA value of 10 indicates equal cost.
98*6520495aSAdrian ChaddA value of -1 means the locality map is not available or no
99*6520495aSAdrian Chaddlocality information is available.
100*6520495aSAdrian Chadd.Pp
101*6520495aSAdrian Chadd.It Va vm.phys_segs
102*6520495aSAdrian ChaddThe map of physical memory, grouped by VM domain.
103*6520495aSAdrian Chadd.El
104*6520495aSAdrian Chadd.Sh IMPLEMENTATION NOTES
105*6520495aSAdrian ChaddThe current
106*6520495aSAdrian Chadd.Nm
107*6520495aSAdrian Chaddimplementation is VM-focused.
108*6520495aSAdrian ChaddThe hardware
109*6520495aSAdrian Chadd.Nm
110*6520495aSAdrian Chadddomains are mapped into a contiguous, non-sparse
111*6520495aSAdrian ChaddVM domain space, starting from 0.
112*6520495aSAdrian ChaddThus, VM domain information (for example, the domain identifier) is not
113*6520495aSAdrian Chaddnecessarily the same as is found in the hardware specific information.
114*6520495aSAdrian Chadd.Pp
115*6520495aSAdrian ChaddThe
116*6520495aSAdrian Chadd.Nm
117*6520495aSAdrian Chaddallocation policies are implemented as a policy and iterator in
118*6520495aSAdrian Chadd.Pa sys/vm/vm_domain.c
119*6520495aSAdrian Chaddand
120*6520495aSAdrian Chadd.Pa sys/vm/vm_domain.h .
121*6520495aSAdrian ChaddPolicy information is available in both struct thread and struct proc.
122*6520495aSAdrian ChaddProcesses inherit
123*6520495aSAdrian Chadd.Nm
124*6520495aSAdrian Chaddpolicy from parent processes and threads inherit
125*6520495aSAdrian Chadd.Nm
126*6520495aSAdrian Chaddpolicy from parent threads.
127*6520495aSAdrian ChaddNote that threads do not explicitly inherit their
128*6520495aSAdrian Chadd.Nm
129*6520495aSAdrian Chaddpolicy from processes.
130*6520495aSAdrian ChaddInstead, if no thread policy is set, the system
131*6520495aSAdrian Chaddwill fall back to the process policy.
132*6520495aSAdrian Chadd.Pp
133*6520495aSAdrian ChaddFor now,
134*6520495aSAdrian Chadd.Nm
135*6520495aSAdrian Chadddomain policies only influence physical page allocation in
136*6520495aSAdrian Chadd.Pa sys/vm/vm_phys.c .
137*6520495aSAdrian ChaddThis is useful for userland memory allocation, but not for kernel
138*6520495aSAdrian Chaddand driver memory allocation.
139*6520495aSAdrian ChaddThese features will be implemented in future work.
140*6520495aSAdrian Chadd.Sh SEE ALSO
141*6520495aSAdrian Chadd.Xr numactl 1 ,
142*6520495aSAdrian Chadd.Xr numa_getaffinity 2 ,
143*6520495aSAdrian Chadd.Xr numa_setaffinity 2 ,
144*6520495aSAdrian Chadd.Xr bus_get_domain 9
145*6520495aSAdrian Chadd.Sh HISTORY
146*6520495aSAdrian Chadd.Nm
147*6520495aSAdrian Chaddfirst appeared in
148*6520495aSAdrian Chadd.Fx 9.0
149*6520495aSAdrian Chaddas a first-touch allocation policy with a fail-over to round-robin allocation
150*6520495aSAdrian Chaddand was not configurable.
151*6520495aSAdrian ChaddIt was then modified in
152*6520495aSAdrian Chadd.Fx 10.0
153*6520495aSAdrian Chaddto implement a round-robin allocation policy and was also not configurable.
154*6520495aSAdrian Chadd.Pp
155*6520495aSAdrian ChaddThe
156*6520495aSAdrian Chadd.Xr numa_getaffinity 2
157*6520495aSAdrian Chaddand
158*6520495aSAdrian Chadd.Xr numa_setaffinity 2
159*6520495aSAdrian Chaddsyscalls first appeared in
160*6520495aSAdrian Chadd.Fx 11.0 .
161*6520495aSAdrian Chadd.Pp
162*6520495aSAdrian ChaddThe
163*6520495aSAdrian Chadd.Xr numactl 1
164*6520495aSAdrian Chaddtool first appeared in
165*6520495aSAdrian Chadd.Fx 11.0 .
166*6520495aSAdrian Chadd.Sh AUTHORS
167*6520495aSAdrian ChaddThis manual page written by
168*6520495aSAdrian Chadd.An Adrian Chadd Aq Mt adrian@FreeBSD.org .
169*6520495aSAdrian Chadd.Sh NOTES
170*6520495aSAdrian ChaddNo statistics are kept to indicate how often
171*6520495aSAdrian Chadd.Nm
172*6520495aSAdrian Chaddallocation policies succeed or fail.
173