]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - usr.bin/cpuset/cpuset.1
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / usr.bin / cpuset / cpuset.1
1 .\" Copyright (c) 2008 Christian Brueffer
2 .\" Copyright (c) 2008 Jeffrey Roberson
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .Dd January 14, 2011
29 .Dt CPUSET 1
30 .Os
31 .Sh NAME
32 .Nm cpuset
33 .Nd "configure processor sets"
34 .Sh SYNOPSIS
35 .Nm
36 .Op Fl l Ar cpu-list
37 .Op Fl s Ar setid
38 .Ar cmd ...
39 .Nm
40 .Op Fl l Ar cpu-list
41 .Op Fl s Ar setid
42 .Fl p Ar pid
43 .Nm
44 .Op Fl c
45 .Op Fl l Ar cpu-list
46 .Fl C
47 .Fl p Ar pid
48 .Nm
49 .Op Fl cr
50 .Op Fl l Ar cpu-list
51 .Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
52 .Nm
53 .Op Fl cgir
54 .Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
55 .Sh DESCRIPTION
56 The
57 .Nm
58 command can be used to assign processor sets to processes, run commands
59 constrained to a given set or list of processors, and query information
60 about processor binding, sets, and available processors in the system.
61 .Pp
62 .Nm
63 requires a target to modify or query.
64 The target may be specified as a command, process id, thread id, a
65 cpuset id, an irq or a jail id.
66 Using
67 .Fl g
68 the target's set id or mask may be queried.
69 Using
70 .Fl l
71 or
72 .Fl s
73 the target's CPU mask or set id may be set.
74 If no target is specified,
75 .Nm
76 operates on itself.
77 Not all combinations of operations and targets are supported.
78 For example,
79 you may not set the id of an existing set or query and launch a command
80 at the same time.
81 .Pp
82 There are two sets applicable to each process and one private mask per thread.
83 Every process in the system belongs to a cpuset.
84 By default processes are started in set 1.
85 The mask or id may be queried using
86 .Fl c .
87 Each thread also has a private mask of CPUs it is allowed to run
88 on that must be a subset of the assigned set.
89 And finally, there is a root set, numbered 0, that is immutable.
90 This last set is the list of all possible CPUs in the system and is
91 queried using
92 .Fl r .
93 .Pp
94 When running a command it may join a set specified with
95 .Fl s
96 otherwise a new set is created.
97 In addition, a mask for the command may be specified using
98 .Fl l .
99 When used in conjunction with
100 .Fl c
101 the mask modifies the supplied or created set rather than the private mask
102 for the thread.
103 .Pp
104 The options are as follows:
105 .Bl -tag -width ".Fl l Ar cpu-list"
106 .It Fl C
107 Create a new cpuset and assign the target process to that set.
108 .It Fl c
109 The requested operation should reference the cpuset available via the
110 target specifier.
111 .It Fl g
112 Causes
113 .Nm
114 to print either a list of valid CPUs or, using
115 .Fl i ,
116 the id of the target.
117 .It Fl i
118 When used with the
119 .Fl g
120 option print the id rather than the valid mask of the target.
121 .It Fl j Ar jailid
122 Specifies a jail id as the target of the operation.
123 .It Fl l Ar cpu-list
124 Specifies a list of CPUs to apply to a target.
125 Specification may include
126 numbers separated by '-' for ranges and commas separating individual numbers.
127 A special list of
128 .Dq all
129 may be specified in which case the list includes all CPUs from the root set.
130 .It Fl p Ar pid
131 Specifies a pid as the target of the operation.
132 .It Fl s Ar setid
133 Specifies a set id as the target of the operation.
134 .It Fl r
135 The requested operation should reference the root set available via the
136 target specifier.
137 .It Fl t Ar tid
138 Specifies a thread id as the target of the operation.
139 .It Fl x Ar irq
140 Specifies an irq as the target of the operation.
141 .El
142 .Sh EXIT STATUS
143 .Ex -std
144 .Sh EXAMPLES
145 Create a new group with CPUs 0-4 inclusive and run
146 .Pa /bin/sh
147 on it:
148 .Dl cpuset -c -l 0-4 /bin/sh
149 .Pp
150 Query the mask of CPUs the
151 .Aq sh pid
152 is allowed to run on:
153 .Dl cpuset -g -p <sh pid>
154 .Pp
155 Restrict
156 .Pa /bin/sh
157 to run on CPUs 0 and 2 while its group is still allowed to run on
158 CPUs 0-4:
159 .Dl cpuset -l 0,2 -p <sh pid>
160 .Pp
161 Modify the cpuset
162 .Pa /bin/sh
163 belongs to restricting it to CPUs 0 and 2:
164 .Dl cpuset -l 0,2 -c -p <sh pid>
165 .Pp
166 Modify the cpuset all threads are in by default to contain only
167 the first 4 CPUs, leaving the rest idle:
168 .Dl cpuset -l 0-3 -s 1
169 .Pp
170 Print the id of the cpuset
171 .Pa /bin/sh
172 is in:
173 .Dl cpuset -g -i -p <sh pid>
174 .Pp
175 Move the
176 .Ar pid
177 into the specified cpuset
178 .Ar setid
179 so it may be managed with other pids in that set:
180 .Dl cpuset -s <setid> -p <pid>
181 .Pp
182 Create a new cpuset that is restricted to CPUs 0 and 2 and move
183 .Ar pid
184 into the new set:
185 .Dl cpuset -C -c -l 0,2 -p <pid>
186 .Sh SEE ALSO
187 .Xr cpuset 2
188 .Sh HISTORY
189 The
190 .Nm
191 command first appeared in
192 .Fx 7.1 .
193 .Sh AUTHORS
194 .An Jeffrey Roberson Aq jeff@FreeBSD.org