1 .\" Copyright (c) 2018 Jeffrey Roberson
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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
28 .Dt CPUSET_GETDOMAIN 2
31 .Nm cpuset_getdomain ,
33 .Nd manage memory domain policy
40 .Fn cpuset_getdomain "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "domainset_t *mask" "int *policy"
42 .Fn cpuset_setdomain "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "const domainset_t *mask" "int policy"
47 allow the manipulation of sets of memory domains and allocation policy available
48 to processes, threads, jails and other resources.
49 These functions may manipulate sets of memory domains that contain many processes
50 or per-object anonymous masks that affect only a single object.
52 The valid values for the
56 arguments are documented in
58 These arguments specify which object and which set of the object we are
60 Not all possible combinations are valid.
61 For example, only processes may belong to a numbered set accessed by a
64 .Dv CPU_LEVEL_CPUSET .
65 All resources, however, have a mask which may be manipulated with
70 are composed using the
73 The kernel tolerates large sets as long as all domains specified
75 Sets smaller than the kernel uses generate an error on calls to
77 even if the result set would fit within the user supplied set.
80 tolerate small sets with no restrictions.
82 The supplied mask should have a size of
85 This size is usually provided by calling
87 which is ultimately determined by the value of
94 mask and policy from the object specified by
99 and stores it in the space provided by
105 attempts to set the mask and policy for the object specified by
114 .Sh ALLOCATION POLICIES
115 Valid policy values are as follows:
116 .Bl -tag -width "foo"
117 .It Dv DOMAINSET_POLICY_ROUNDROBIN
118 Memory is allocated on a round-robin basis by cycling through each domain in
120 .It Dv DOMAINSET_POLICY_FIRSTTOUCH
121 Memory is allocated on the domain local to the CPU the requesting thread is
123 Failure to allocate from this domain will fallback to round-robin.
124 .It Dv DOMAINSET_POLICY_PREFER
125 Memory is allocated preferentially from the single domain specified in the mask.
126 If memory is unavailable the domains listed in the parent cpuset will be
127 visited in a round-robin order.
132 The following error codes may be set in
135 .\" When changing this list, consider updating share/man/man3/pthread_create.3,
136 .\" since that function can return any of these errors.
142 argument was not a valid value.
147 argument specified when calling
149 was not a valid value.
153 call would leave a thread without a valid CPU to run on because the set
154 does not overlap with the thread's anonymous mask.
156 The mask pointer passed was invalid.
158 The object specified by the
162 arguments could not be found.
166 was either preposterously large or smaller than the kernel set size.
168 The calling process did not have the credentials required to complete the
171 The calling process attempted to act on a process other than itself, while
179 .Xr cpuset_getaffinity 2 ,
181 .Xr cpuset_setaffinity 2 ,
188 family of system calls first appeared in
191 .An Jeffrey Roberson Aq Mt jeff@FreeBSD.org