1 .\" Copyright (c) 2008 Christian Brueffer
2 .\" Copyright (c) 2008 Jeffrey Roberson
3 .\" Copyright (c) 2015 Adrian Chadd
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .Dt NUMA_GETAFFINITY 2
33 .Nm numa_getaffinity ,
35 .Nd manage NUMA affinity
42 .Fn numa_getaffinity "cpuwhich_t which" "id_t id" "struct vm_domain_policy_entry *policy"
44 .Fn numa_setaffinity "cpuwhich_t which" "id_t id" "const struct vm_domain_policy_entry *policy"
49 allow the manipulation of NUMA policies available to processes and threads.
50 These functions may manipulate NUMA policies that contain many processes
51 or affect only a single object.
55 argument are documented in
57 These arguments specify which object set are used.
66 entry contains a vm_domain_policy_entry with the following fields:
68 struct vm_domain_policy_entry {
69 vm_domain_policy_type_t policy; /* VM policy */
70 int domain; /* VM domain, if applicable */
73 .Fa vm_domain_policy_type_t policy
75 .Bl -tag -width VM_POLICY_NONE
77 Reset the domain back to none.
78 Any parent object NUMA domain policy will apply.
79 The only valid value for
82 .It Dv VM_POLICY_ROUND_ROBIN
83 Select round-robin policy.
84 Pages will be allocated round-robin from each VM domain in order.
85 The only valid value for
88 .It Dv VM_POLICY_FIXED_DOMAIN
89 Select fixed-domain only policy.
90 Pages will be allocated from the given
92 which must be set to a valid VM domain.
93 Pages will not be allocated from another domain if
96 .It Dv VM_POLICY_FIXED_DOMAIN_ROUND_ROBIN
97 Select fixed-domain only policy.
98 Pages will be allocated from
100 which must be set to a valid VM domain.
101 If page allocation fails, pages will be round-robin
102 allocated from another domain if
104 is out of free pages.
105 .It Dv VM_POLICY_FIRST_TOUCH
106 Select first-touch policy.
107 Pages will be allocated from the NUMA domain which the thread
108 is currently scheduled upon.
109 Pages will not be allocated from another domain if the current domain
110 is out of free pages.
111 The only valid value for
114 .It Dv VM_POLICY_FIRST_TOUCH_ROUND_ROBIN
115 Select first-touch policy.
116 Pages will be allocated from the NUMA domain which the thread
117 is currently scheduled upon.
118 Pages will be allocated round-robin from another domain if the
119 current domain is out of free pages.
120 The only valid value for
125 Note that the VM might assign some pages from other domains.
126 For example, if an existing page allocation is covered by a superpage
131 NUMA policy from the object specified by
135 and stores it in the space provided by
139 attempts to set the NUMA policy for the object specified by
149 can contain these error codes:
156 argument was not a valid value.
160 argument specified when calling
162 did not contain a valid policy.
164 The policy pointer passed was invalid.
166 The object specified by the
170 arguments could not be found.
175 was out of the range of possible VM domains available.
177 The calling process did not have the credentials required to complete the
184 .Xr cpuset_getaffinity 2 ,
186 .Xr cpuset_setaffinity 2 ,
188 .Xr pthread_affinity_np 3 ,
189 .Xr pthread_attr_affinity_np 3 ,
194 family of system calls first appeared in
197 .An Adrian Chadd Aq Mt adrian@FreeBSD.org