Debian Codegraph @

doc/cset-shield.1

raw
1 '\" t
2 .\" Title: cset-shield
3 .\" Author: Alex Tsariounov <[email protected]>
4 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
5 .\" Date: March 2016
6 .\" Manual: \ \&
7 .\" Source: \ \& 1.5.8
8 .\" Language: English
9 .\"
10 .TH "CSET\-SHIELD" "1" "March 2016" "\ \& 1\&.5\&.8" "\ \&"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 cset-shield \- cpuset supercommand which implements cpu shielding
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 \fIcset\fR [cset options] \fIshield\fR [shield options] [args]
36 \fIcset\fR shield \-\-help
37 \fIcset\fR shield
38 \fIcset\fR shield \-\-cpu 1\-7
39 \fIcset\fR shield \-\-cpu 1\-7 \-\-kthread=on
40 \fIcset\fR shield \-\-exec /opt/software/myapp/doit \-\-my_opt1 \-\-my_opt2
41 \fIcset\fR shield \-\-user appuser \-\-exec run_benchmark\&.sh
42 \fIcset\fR shield \-\-shield \-\-pid 1024,2048,5000\-1000
43 \fIcset\fR shield \-\-unshield \-\-pid 6000\-8500
44 \fIcset\fR shield \-\-kthread=off
45 \fIcset\fR shield \-\-kthread=on
46 \fIcset\fR shield \-\-shield bash
47 .fi
48 .SH "OPTIONS"
49 .PP
50 \-h, \-\-help
51 .RS 4
52 prints the list of options for this command
53 .RE
54 .PP
55 \-c CPUSPEC, \-\-cpu=CPUSPEC
56 .RS 4
57 modifies or initializes the shield cpusets
58 .RE
59 .PP
60 \-r, \-\-reset
61 .RS 4
62 destroys the shield
63 .RE
64 .PP
65 \-e, \-\-exec
66 .RS 4
67 executes args in the shield
68 .RE
69 .PP
70 \-\-user=USER
71 .RS 4
72 use this USER for \-\-exec (id or name)
73 .RE
74 .PP
75 \-\-group=GROUP
76 .RS 4
77 use this GROUP for \-\-exec (id or name)
78 .RE
79 .PP
80 \-s, \-\-shield
81 .RS 4
82 shield PIDSPEC specified with \-p/\-\-pid of processes or threads
83 .RE
84 .PP
85 \-u, \-\-unshield
86 .RS 4
87 remove PIDSPEC specified with \-p/\-\-pid of processes or threads from the shield, the tasks keep running in the unshielded cpuset
88 .RE
89 .PP
90 \-\-threads
91 .RS 4
92 if specified, any processes found in the PIDSPEC to have multiple threads will automatically have all their threads added to the PIDSPEC (use to shield or unshield all related threads)
93 .RE
94 .PP
95 \-k on|off, \-\-kthread=on|off
96 .RS 4
97 shield from unbound interrupt threads as well
98 .RE
99 .PP
100 \-f, \-\-force
101 .RS 4
102 force operation, use with care
103 .RE
104 .PP
105 \-v, \-\-verbose
106 .RS 4
107 prints more detailed output, additive
108 .RE
109 .PP
110 \-\-sysset=SYSSET
111 .RS 4
112 optionally specify system cpuset name
113 .RE
114 .PP
115 \-\-userset=USERSET
116 .RS 4
117 optionally specify user cpuset name
118 .RE
119 .SH "DESCRIPTION"
120 This is a supercommand that creates basic cpu shielding\&. The normal cset commands can of course be used to create this basic shield, but the shield command combines many such commands to create and manage a common type of cpu shielding setup\&.
121
122 The concept of shielding implies at minimum three cpusets, for example: root, user and system\&. The root cpuset always exists in all implementations of cpusets and contains all available CPUs on the machine\&. The system cpuset is so named because normal system tasks are made to run on it\&. The user cpuset is so named because that is the "shielded" cpuset on which you would run your tasks of interest\&.
123
124 Usually, CPU zero would be in the system set and the rest of the CPUs would be in the user set\&. After creation of the cpusets, all processes running in the root cpuset are moved to the system cpuset\&. Thus any new processes or threads spawned from these processes will also run the system cpuset\&.
125
126 If the optional \-\-kthread=on option is given to the shield command, then all kernel threads (with exception of the per\-CPU bound interrupt kernel threads) are also moved to the system set\&.
127
128 One executes processes on the shielded user cpuset with the \-\-exec subcommand or moves processes or threads to the shielded cpuset with the \-\-shield subcommand with a \-\-pid option\&.
129 .if n \{\
130 .sp
131 .\}
132 .RS 4
133 .it 1 an-trap
134 .nr an-no-space-flag 1
135 .nr an-break-flag 1
136 .br
137 .ps +1
138 \fBNote\fR
139 .ps -1
140 .br
141 You do not need to specify which cpuset a process or thread is running in initially when using the \-\-shield subcommand\&.
142 .sp .5v
143 .RE
144 To create a shield, you would execute the shield command with the \-\-cpu option that specifies CPUSPEC argument that assigns CPUs to be under the shield (this means assigned to the user cpuset, all other cpus will be assigned to the system set)\&.
145
146 For example:
147
148 \fB# cset shield \-\-cpu=1\-3\fR
149
150 On a 4\-way machine, this command will dedicate the first processor, CPU0, for the system set (unshielded) and the last three processors, CPU1, CPU2, CPU3, for the user set (shielded)\&.
151
152 The CPUSPEC will accept a comma separated list of CPUs and inclusive range specifications\&. For example, \-\-cpu=1,3,5\-7 will assign CPU1, CPU3, CPU5, CPU6, and CPU7 to the user (or shielded) cpuset and the inverse of that to the system (or unshielded) cpuset\&.
153
154 If you do not like the names "system" and "user" for the unshielded and shielded sets respectively, or if those names are used already, then use the \-\-sysset and \-\-userset options\&.
155
156 For example:
157
158 \fB# cset shield \-\-sysset=free \-\-userset=cage \-\-cpu=2,3 \-\-kthread=on\fR
159
160 The above command will use the name "free" for the unshielded system cpuset, the name "cage" for the shielded user cpuset, initialize these cpusets and dedicate CPU0 and CPU1 to the "free" set and (on a 4\-way machine) dedicate CPU2 and CPU3 to the "cage" set\&. Further, the command moves all processes and threads, including kernel threads from the root cpuset to the "free" cpuset\&.
161 .if n \{\
162 .sp
163 .\}
164 .RS 4
165 .it 1 an-trap
166 .nr an-no-space-flag 1
167 .nr an-break-flag 1
168 .br
169 .ps +1
170 \fBNote\fR
171 .ps -1
172 .br
173 If you do use the \-\-sysset/\-\-userset options, then you must continue to use those for every invocation of the shield supercommand\&.
174 .sp .5v
175 .RE
176 After initialization, you can run the process of interest on the shielded cpuset with the \-\-exec subcommand, or move processes or threads already running to the shielded cpuset with the \-\-shield subcommand and the \-\-pid option\&.
177
178 Note that if your execed command takes options, then use the traditional "\-\-" marker to separate cset\(cqs options from your command\(cqs options\&.
179
180 For example:
181
182 \fB# cset shield \-\-exec \(em ls \-l\fR
183
184 This command will execute "ls \-l" inside the shield\&.
185
186 The PIDSPEC argument taken for the \-\-pid (or \-p) option is a comma separated list of PIDs or TIDs\&. The list can also include brackets of PIDs or TIDs that are inclusive of the endpoints\&.
187
188 For example:
189
190 .sp
191 .if n \{\
192 .RS 4
193 .\}
194 .nf
195 1,2,5 Means processes 1, 2 and 5
196 1,2,600\-700 Means processes 1, 2 and from 600 to 700
197 .fi
198 .if n \{\
199 .RE
200 .\}
201 .sp
202 \fB# cset shield \-\-shield \-\-pid=50\-65\fR
203
204 The above command moves all processes and threads with PID or TID in the range 50\-65 inclusive, from the system cpuset into the shielded user cpuset\&. If they are running in the root cpuset, you must use the \-\-force option to actually move them into the shield\&.
205 .if n \{\
206 .sp
207 .\}
208 .RS 4
209 .it 1 an-trap
210 .nr an-no-space-flag 1
211 .nr an-break-flag 1
212 .br
213 .ps +1
214 \fBNote\fR
215 .ps -1
216 .br
217 The range of PIDs or TIDs does not need to have every position populated\&. In other words, for the example above, if there is only one process, say PID 57, in the range of 50\-65, then only that process will be moved\&.
218 .sp .5v
219 .RE
220 The \-\-unshield (or \-u) subcommand will remove the specified processes or threads from the shielded cpuset and move them into the unshielded (or system) cpuset\&. This command is also used in conjunction with a \-p/\-\-pid option that specifies a PIDSPEC argument, the same as for the \-\-shield subcommand\&.
221
222 Both the \-\-shield and the \-\-unshield commands will also finally output the number of tasks running in the shield and out of the shield if you do not specify a PIDSPEC with \-\-pid\&. By specifying also a \-\-verbose in addition, then you will get a listing of every task that is running in either the shield or out of the shield\&.
223
224 Using no subcommand, ie\&. only "cset shield", will output the status of both shield and non\-shield\&. Tasks will be listed if \-\-verbose is used\&.
225
226 You can adjust which CPUs are in the shielded cpuset by issuing the \-\-cpu subcommand again anytime after the shield has been initialized\&.
227
228 For example if the original shield contained CPU0 and CPU1 in the system set and CPU2 and CPU3 in the user set, if you then issue the following command:
229
230 \fB# cset shield \-\-cpu=1,2,3\fR
231
232 then that command will move CPU1 into the shielded "user" cpuset\&. Any processes or threads that were running on CPU1 that belonged to the unshielded "system" cpuset are migrated to CPU0 by the system\&.
233
234 The \-\-reset subcommand will in essence destroy the shield\&. For example, if there was a shield on a 4\-way machine with CPU0 in system and CPUs 1\-3 in user with processes running on the user cpuset (i\&.e\&. in the shield), and a \-\-reset subcommand was issued, then all processes running in both system and user cpusets would be migrated to the root cpuset (which has access to all CPUs and never goes away), after which both system and user cpusets would be destroyed\&.
235 .if n \{\
236 .sp
237 .\}
238 .RS 4
239 .it 1 an-trap
240 .nr an-no-space-flag 1
241 .nr an-break-flag 1
242 .br
243 .ps +1
244 \fBNote\fR
245 .ps -1
246 .br
247 Even though you can mix general usage of cpusets with the shielding concepts described here, you generally will not want to\&. For more complex shielding or usage scenarios, one would generally use the normal cpuset commands (i\&.e\&. cset set and proc) directly\&.
248 .sp .5v
249 .RE
250 .SH "LICENSE"
251 Cpuset is licensed under the GNU GPL V2 only\&.
252 .SH "COPYRIGHT"
253 Copyright (c) 2008\-2011 Novell Inc\&.
254 .SH "AUTHOR"
255 Written by Alex Tsariounov <tsariounov@gmail\&.com>\&.
256 .SH "SEE ALSO"
257 cset(1), cset\-set(1), cset\-proc(1)
258
259 /usr/share/doc/packages/cpuset/html/tutorial\&.html
260
261 taskset(1), chrt(1)
262
263 /usr/src/linux/Documentation/cpusets\&.txt
264 .SH "AUTHOR"
265 .PP
266 \fBAlex Tsariounov\fR <\&tsariounov@gmail\&.com\&>
267 .RS 4
268 Author.
269 .RE