| 1 |
'\" t |
| 2 |
.\" Title: cset-proc |
| 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\-PROC" "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-proc \- manage processes running in cpusets |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.sp |
| 34 |
.nf |
| 35 |
\fIcset\fR [cset options] \fIproc\fR [proc options] [args] |
| 36 |
\fIcset\fR proc \-\-help |
| 37 |
\fIcset\fR proc |
| 38 |
\fIcset\fR proc my_set my_other_set |
| 39 |
\fIcset\fR proc \-\-list \-\-set my_set |
| 40 |
\fIcset\fR proc \-\-exec my_set /opt/software/my_code \-\-my_opt_1 |
| 41 |
\fIcset\fR proc \-\-set my_set \-\-exec /opt/software/my_code \-\-my_opt_1 |
| 42 |
\fIcset\fR proc \-\-move 2442,3000\-3200 my_set |
| 43 |
\fIcset\fR proc \-\-move \-\-pid=2442,3000\-3200 \-\-toset=my_set |
| 44 |
\fIcset\fR proc \-\-move \-\-fromset=my_set_1 \-\-toset=my_set_2 |
| 45 |
\fIcset\fR proc \-\-move \-\-pid=42 \-\-fromset=/group1/myset \-\-toset=/group2/yourset |
| 46 |
.fi |
| 47 |
.SH "OPTIONS" |
| 48 |
.PP |
| 49 |
\-h, \-\-help |
| 50 |
.RS 4 |
| 51 |
prints the list of options for this command |
| 52 |
.RE |
| 53 |
.PP |
| 54 |
\-l, \-\-list |
| 55 |
.RS 4 |
| 56 |
list processes in the specified cpuset |
| 57 |
.RE |
| 58 |
.PP |
| 59 |
\-e, \-\-exec |
| 60 |
.RS 4 |
| 61 |
execute arguments in the specified cpuset |
| 62 |
.RE |
| 63 |
.PP |
| 64 |
\-u USER, \-\-user=USER |
| 65 |
.RS 4 |
| 66 |
use this USER to \-\-exec (id or name) |
| 67 |
.RE |
| 68 |
.PP |
| 69 |
\-g GROUP, \-\-group=GROUP |
| 70 |
.RS 4 |
| 71 |
use this GROUP to \-\-exec (id or name) |
| 72 |
.RE |
| 73 |
.PP |
| 74 |
\-m, \-\-move |
| 75 |
.RS 4 |
| 76 |
move specified tasks to specified cpuset; to move a PIDSPEC to a cpuset, use \-m PIDSPEC cpuset; to move all tasks specify \-\-fromset and \-\-toset |
| 77 |
.RE |
| 78 |
.PP |
| 79 |
\-p PIDSPEC, \-\-pid=PIDSPEC |
| 80 |
.RS 4 |
| 81 |
specify pid or tid specification |
| 82 |
.RE |
| 83 |
.PP |
| 84 |
\-\-threads |
| 85 |
.RS 4 |
| 86 |
if specified, any processes found in the PIDSPEC to have multiple threads will automatically have all their threads added to the PIDSPEC (use to move all related threads to a cpuset) |
| 87 |
.RE |
| 88 |
.PP |
| 89 |
\-s CPUSET, \-\-set=CPUSET |
| 90 |
.RS 4 |
| 91 |
specify name of immediate cpuset |
| 92 |
.RE |
| 93 |
.PP |
| 94 |
\-t TOSET, \-\-toset=TOSET |
| 95 |
.RS 4 |
| 96 |
specify name of destination cpuset |
| 97 |
.RE |
| 98 |
.PP |
| 99 |
\-f FROMSET, \-\-fromset=FROMSET |
| 100 |
.RS 4 |
| 101 |
specify name of origination cpuset |
| 102 |
.RE |
| 103 |
.PP |
| 104 |
\-k, \-\-kthread |
| 105 |
.RS 4 |
| 106 |
move, or include moving, unbound kernel threads |
| 107 |
.RE |
| 108 |
.PP |
| 109 |
\-\-force |
| 110 |
.RS 4 |
| 111 |
force all processes and threads to be moved |
| 112 |
.RE |
| 113 |
.PP |
| 114 |
\-v, \-\-verbose |
| 115 |
.RS 4 |
| 116 |
prints more detailed output, additive |
| 117 |
.RE |
| 118 |
.SH "DESCRIPTION" |
| 119 |
This command is used to run and manage arbitrary processes on specified cpusets\&. It is also used to move pre\-existing processes and threads to specified cpusets\&. You may note there is no "kill" or "destroy" option \(em use the standard OS ^C or kill commands for that\&. |
| 120 |
|
| 121 |
To list which tasks are running in a particular cpuset, use the \-\-list command\&. |
| 122 |
|
| 123 |
For example: |
| 124 |
|
| 125 |
\fB# cset proc \-\-list \-\-set myset\fR |
| 126 |
|
| 127 |
This command will list all the tasks running in the cpuset called "myset"\&. |
| 128 |
|
| 129 |
Processes are created by specifying the path to the executable and specifying the cpuset that the process is to be created in\&. |
| 130 |
|
| 131 |
For example: |
| 132 |
|
| 133 |
\fB# cset proc \-\-set=blazing_cpuset \-\-exec /usr/bin/fast_code\fR |
| 134 |
|
| 135 |
This command will execute the /usr/bin/fast_code program on the "blazing_cpuset" cpuset\&. |
| 136 |
|
| 137 |
Note that if your command takes options, then use the traditional "\-\-" marker to separate cset\(cqs options from your command\(cqs options\&. |
| 138 |
|
| 139 |
For example: |
| 140 |
|
| 141 |
\fB# cset proc \-\-set myset \-\-exec \(em ls \-l\fR |
| 142 |
|
| 143 |
This command will execute "ls \-l" on the cpuset called "myset"\&. |
| 144 |
|
| 145 |
The PIDSPEC argument taken for the move command is a comma separated list of PIDs or TIDs\&. The list can also include brackets of PIDs or TIDs (i\&.e\&. tasks) that are inclusive of the endpoints\&. |
| 146 |
|
| 147 |
For example: |
| 148 |
|
| 149 |
.sp |
| 150 |
.if n \{\ |
| 151 |
.RS 4 |
| 152 |
.\} |
| 153 |
.nf |
| 154 |
1,2,5 Means processes 1, 2 and 5 |
| 155 |
1,2,600\-700 Means processes 1, 2 and from 600 to 700 |
| 156 |
.fi |
| 157 |
.if n \{\ |
| 158 |
.RE |
| 159 |
.\} |
| 160 |
.sp |
| 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 |
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\&. |
| 174 |
.sp .5v |
| 175 |
.RE |
| 176 |
To move a PIDSPEC to a specific cpuset, you can either specify the PIDSPEC with \-\-pid and the destination cpuset with \-\-toset, or use the short hand and list the cpuset name after the PIDSPEC for the \-\-move arguments\&. |
| 177 |
|
| 178 |
The move command accepts multiple common calling methods\&. For example, the following commands are equivalent: |
| 179 |
|
| 180 |
\fB# cset proc \-\-move 2442,3000\-3200 reserved_set\fR |
| 181 |
|
| 182 |
\fB# cset proc \-\-move \-\-pid=2442,3000\-3200 \-\-toset=reserved_set\fR |
| 183 |
|
| 184 |
These commands move the tasks defined as 2442 and any running task between 3000 and 3200 inclusive of the ends to the cpuset called "reserved_set"\&. |
| 185 |
|
| 186 |
Specifying the \-\-fromset is not necessary since the tasks will be moved to the destination cpuset no matter which cpuset they are currently running on\&. |
| 187 |
.if n \{\ |
| 188 |
.sp |
| 189 |
.\} |
| 190 |
.RS 4 |
| 191 |
.it 1 an-trap |
| 192 |
.nr an-no-space-flag 1 |
| 193 |
.nr an-break-flag 1 |
| 194 |
.br |
| 195 |
.ps +1 |
| 196 |
\fBNote\fR |
| 197 |
.ps -1 |
| 198 |
.br |
| 199 |
However, if you do specify a cpuset with the \-\-fromset option, then only those tasks that are both in the PIDSPEC \fBand\fR are running in the cpuset specified by \-\-fromset will be moved\&. I\&.e\&., if there is a task running on the system but not in \-\-fromset that is in PIDSPEC, it will not be moved\&. |
| 200 |
.sp .5v |
| 201 |
.RE |
| 202 |
If the \-\-threads switch is used, then the proc command will gather any threads of belonging to any processes or threads that are specified in the PIDSPEC and move them\&. This provides an easy way to move all related threads: just pick one TID from the set and use the \-\-threads option\&. |
| 203 |
|
| 204 |
To move all userspace tasks from one cpuset to another, you need to specify the source and destination cpuset by name\&. |
| 205 |
|
| 206 |
For example: |
| 207 |
|
| 208 |
\fB# cset proc \-\-move \-\-fromset=comp1 \-\-toset=comp42\fR |
| 209 |
|
| 210 |
This command specifies that all processes and threads running on cpuset "comp1" be moved to cpuset "comp42"\&. |
| 211 |
.if n \{\ |
| 212 |
.sp |
| 213 |
.\} |
| 214 |
.RS 4 |
| 215 |
.it 1 an-trap |
| 216 |
.nr an-no-space-flag 1 |
| 217 |
.nr an-break-flag 1 |
| 218 |
.br |
| 219 |
.ps +1 |
| 220 |
\fBNote\fR |
| 221 |
.ps -1 |
| 222 |
.br |
| 223 |
This move command will not move kernel threads unless the \-k/\-\-kthread switch is specified\&. If it is, then all unbound kernel threads will be added to the move\&. Unbound kernel threads are those that can run on any CPU\&. If you \fBalso specify\fR the \-\-force switch, then all tasks, kernel or not, bound or not, will be moved\&. |
| 224 |
.sp .5v |
| 225 |
.RE |
| 226 |
.if n \{\ |
| 227 |
.sp |
| 228 |
.\} |
| 229 |
.RS 4 |
| 230 |
.it 1 an-trap |
| 231 |
.nr an-no-space-flag 1 |
| 232 |
.nr an-break-flag 1 |
| 233 |
.br |
| 234 |
.ps +1 |
| 235 |
\fBCaution\fR |
| 236 |
.ps -1 |
| 237 |
.br |
| 238 |
Please be cautious with the \-\-force switch, since moving a kernel thread that is bound to a specific CPU to a cpuset that does not include that CPU can cause a system hang\&. |
| 239 |
.sp .5v |
| 240 |
.RE |
| 241 |
You must specify unique cpuset names for the both exec and move commands\&. If a simple name passed to the \-\-fromset, \-\-toset and \-\-set parameters is unique on the system then that command executes\&. However, if there are multiple cpusets by that name, then you will need to specify which one you mean with a full path rooted at the base cpuset tree\&. |
| 242 |
|
| 243 |
For example, suppose you have the following cpuset tree: |
| 244 |
|
| 245 |
.sp |
| 246 |
.if n \{\ |
| 247 |
.RS 4 |
| 248 |
.\} |
| 249 |
.nf |
| 250 |
/cpusets |
| 251 |
/group1 |
| 252 |
/myset |
| 253 |
/yourset |
| 254 |
/group2 |
| 255 |
/myset |
| 256 |
/yourset |
| 257 |
.fi |
| 258 |
.if n \{\ |
| 259 |
.RE |
| 260 |
.\} |
| 261 |
.sp |
| 262 |
Then, to move a process from myset in group1 to yourset in group2, you would have to issue the following command: |
| 263 |
|
| 264 |
# cset proc \-\-move \-\-pid=50 \-\-fromset=/group1/myset \-\-toset=/group2/yourset |
| 265 |
|
| 266 |
You do not have to worry about where in the Linux filesystem the cpuset filesystem is mounted\&. The cset command takes care of that\&. Any cpusets that are specified by path (such as above), are done with respect to the root of the cpuset filesystem\&. |
| 267 |
.SH "LICENSE" |
| 268 |
Cpuset is licensed under the GNU GPL V2 only\&. |
| 269 |
.SH "COPYRIGHT" |
| 270 |
Copyright (c) 2008\-2011 Novell Inc\&. |
| 271 |
.SH "AUTHOR" |
| 272 |
Written by Alex Tsariounov <tsariounov@gmail\&.com>\&. |
| 273 |
.SH "SEE ALSO" |
| 274 |
cset(1), cset\-set(1), cset\-shield(1) |
| 275 |
|
| 276 |
/usr/share/doc/packages/cpuset/html/tutorial\&.html |
| 277 |
|
| 278 |
taskset(1), chrt(1) |
| 279 |
|
| 280 |
/usr/src/linux/Documentation/cpusets\&.txt |
| 281 |
.SH "AUTHOR" |
| 282 |
.PP |
| 283 |
\fBAlex Tsariounov\fR <\&tsariounov@gmail\&.com\&> |
| 284 |
.RS 4 |
| 285 |
Author. |
| 286 |
.RE |