| 1 |
cset-proc(1) |
| 2 |
============ |
| 3 |
Alex Tsariounov <[email protected]> |
| 4 |
v1.6, December 2018 |
| 5 |
|
| 6 |
NAME |
| 7 |
---- |
| 8 |
cset-proc - manage processes running in cpusets |
| 9 |
|
| 10 |
SYNOPSIS |
| 11 |
-------- |
| 12 |
[verse] |
| 13 |
'cset' [cset options] 'proc' [proc options] [args] |
| 14 |
'cset' proc --help |
| 15 |
'cset' proc |
| 16 |
'cset' proc my_set my_other_set |
| 17 |
'cset' proc --list --set my_set |
| 18 |
'cset' proc --exec my_set /opt/software/my_code --my_opt_1 |
| 19 |
'cset' proc --set my_set --exec /opt/software/my_code --my_opt_1 |
| 20 |
'cset' proc --move 2442,3000-3200 my_set |
| 21 |
'cset' proc --move --pid=2442,3000-3200 --toset=my_set |
| 22 |
'cset' proc --move --fromset=my_set_1 --toset=my_set_2 |
| 23 |
'cset' proc --move --pid=42 --fromset=/group1/myset --toset=/group2/yourset |
| 24 |
|
| 25 |
OPTIONS |
| 26 |
------- |
| 27 |
-h, --help:: |
| 28 |
prints the list of options for this command |
| 29 |
|
| 30 |
-l, --list:: |
| 31 |
list processes in the specified cpuset |
| 32 |
|
| 33 |
-e, --exec:: |
| 34 |
execute arguments in the specified cpuset |
| 35 |
|
| 36 |
-u USER, --user=USER:: |
| 37 |
use this USER to --exec (id or name) |
| 38 |
|
| 39 |
-g GROUP, --group=GROUP:: |
| 40 |
use this GROUP to --exec (id or name) |
| 41 |
|
| 42 |
-m, --move:: |
| 43 |
move specified tasks to specified cpuset; to move a PIDSPEC to a |
| 44 |
cpuset, use -m PIDSPEC cpuset; to move all tasks specify --fromset |
| 45 |
and --toset |
| 46 |
|
| 47 |
-p PIDSPEC, --pid=PIDSPEC:: |
| 48 |
specify pid or tid specification |
| 49 |
|
| 50 |
--threads:: |
| 51 |
if specified, any processes found in the PIDSPEC to have multiple |
| 52 |
threads will automatically have all their threads added to the |
| 53 |
PIDSPEC (use to move all related threads to a cpuset) |
| 54 |
|
| 55 |
-s CPUSET, --set=CPUSET:: |
| 56 |
specify name of immediate cpuset |
| 57 |
|
| 58 |
-t TOSET, --toset=TOSET:: |
| 59 |
specify name of destination cpuset |
| 60 |
|
| 61 |
-f FROMSET, --fromset=FROMSET:: |
| 62 |
specify name of origination cpuset |
| 63 |
|
| 64 |
-k, --kthread:: |
| 65 |
move, or include moving, unbound kernel threads |
| 66 |
|
| 67 |
--force:: |
| 68 |
force all processes and threads to be moved |
| 69 |
|
| 70 |
-v, --verbose:: |
| 71 |
prints more detailed output, additive |
| 72 |
|
| 73 |
DESCRIPTION |
| 74 |
----------- |
| 75 |
This command is used to run and manage arbitrary processes on |
| 76 |
specified cpusets. It is also used to move pre-existing processes and |
| 77 |
threads to specified cpusets. You may note there is no "kill" or |
| 78 |
"destroy" option -- use the standard OS ^C or kill commands for that. |
| 79 |
|
| 80 |
To list which tasks are running in a particular cpuset, use the --list |
| 81 |
command. |
| 82 |
|
| 83 |
For example: |
| 84 |
|
| 85 |
*+# cset proc --list --set myset+* |
| 86 |
|
| 87 |
This command will list all the tasks running in the cpuset called |
| 88 |
"myset". |
| 89 |
|
| 90 |
Processes are created by specifying the path to the executable |
| 91 |
and specifying the cpuset that the process is to be created in. |
| 92 |
|
| 93 |
For example: |
| 94 |
|
| 95 |
*+# cset proc --set=blazing_cpuset --exec /usr/bin/fast_code+* |
| 96 |
|
| 97 |
This command will execute the /usr/bin/fast_code program on the |
| 98 |
"blazing_cpuset" cpuset. |
| 99 |
|
| 100 |
Note that if your command takes options, then use the traditional |
| 101 |
"--" marker to separate cset's options from your command's options. |
| 102 |
|
| 103 |
For example: |
| 104 |
|
| 105 |
*+# cset proc --set myset --exec -- ls -l+* |
| 106 |
|
| 107 |
This command will execute "ls -l" on the cpuset called "myset". |
| 108 |
|
| 109 |
The PIDSPEC argument taken for the move command is a comma |
| 110 |
separated list of PIDs or TIDs. The list can also include |
| 111 |
brackets of PIDs or TIDs (i.e. tasks) that are inclusive of the |
| 112 |
endpoints. |
| 113 |
|
| 114 |
For example: |
| 115 |
|
| 116 |
1,2,5 Means processes 1, 2 and 5 |
| 117 |
1,2,600-700 Means processes 1, 2 and from 600 to 700 |
| 118 |
|
| 119 |
NOTE: The range of PIDs or TIDs does not need to have every |
| 120 |
position populated. In other words, for the example above, if |
| 121 |
there is only one process, say PID 57, in the range of 50-65, |
| 122 |
then only that process will be moved. |
| 123 |
|
| 124 |
To move a PIDSPEC to a specific cpuset, you can either specify |
| 125 |
the PIDSPEC with --pid and the destination cpuset with --toset, |
| 126 |
or use the short hand and list the cpuset name after the PIDSPEC |
| 127 |
for the --move arguments. |
| 128 |
|
| 129 |
The move command accepts multiple common calling methods. |
| 130 |
For example, the following commands are equivalent: |
| 131 |
|
| 132 |
*+# cset proc --move 2442,3000-3200 reserved_set+* |
| 133 |
|
| 134 |
*+# cset proc --move --pid=2442,3000-3200 --toset=reserved_set+* |
| 135 |
|
| 136 |
These commands move the tasks defined as 2442 and any running task |
| 137 |
between 3000 and 3200 inclusive of the ends to the cpuset called |
| 138 |
"reserved_set". |
| 139 |
|
| 140 |
Specifying the --fromset is not necessary since the tasks will be |
| 141 |
moved to the destination cpuset no matter which cpuset they are |
| 142 |
currently running on. |
| 143 |
|
| 144 |
NOTE: However, if you do specify a cpuset with the --fromset |
| 145 |
option, then only those tasks that are both in the PIDSPEC *and* |
| 146 |
are running in the cpuset specified by --fromset will be moved. |
| 147 |
I.e., if there is a task running on the system but not in |
| 148 |
--fromset that is in PIDSPEC, it will not be moved. |
| 149 |
|
| 150 |
If the --threads switch is used, then the proc command will |
| 151 |
gather any threads of belonging to any processes or threads that |
| 152 |
are specified in the PIDSPEC and move them. This provides an easy |
| 153 |
way to move all related threads: just pick one TID from the set |
| 154 |
and use the --threads option. |
| 155 |
|
| 156 |
To move all userspace tasks from one cpuset to another, you need |
| 157 |
to specify the source and destination cpuset by name. |
| 158 |
|
| 159 |
For example: |
| 160 |
|
| 161 |
*+# cset proc --move --fromset=comp1 --toset=comp42+* |
| 162 |
|
| 163 |
This command specifies that all processes and threads |
| 164 |
running on cpuset "comp1" be moved to cpuset "comp42". |
| 165 |
|
| 166 |
NOTE: This move command will not move kernel threads unless |
| 167 |
the -k/--kthread switch is specified. If it is, then all unbound |
| 168 |
kernel threads will be added to the move. Unbound kernel threads |
| 169 |
are those that can run on any CPU. If you *also specify* the |
| 170 |
--force switch, then all tasks, kernel or not, bound or not, |
| 171 |
will be moved. |
| 172 |
|
| 173 |
CAUTION: Please be cautious with the --force switch, since moving |
| 174 |
a kernel thread that is bound to a specific CPU to a cpuset that |
| 175 |
does not include that CPU can cause a system hang. |
| 176 |
|
| 177 |
You must specify unique cpuset names for the both exec and move |
| 178 |
commands. If a simple name passed to the --fromset, --toset and |
| 179 |
--set parameters is unique on the system then that command |
| 180 |
executes. However, if there are multiple cpusets by that name, |
| 181 |
then you will need to specify which one you mean with a full path |
| 182 |
rooted at the base cpuset tree. |
| 183 |
|
| 184 |
For example, suppose you have the following cpuset tree: |
| 185 |
|
| 186 |
/cpusets |
| 187 |
/group1 |
| 188 |
/myset |
| 189 |
/yourset |
| 190 |
/group2 |
| 191 |
/myset |
| 192 |
/yourset |
| 193 |
|
| 194 |
Then, to move a process from myset in group1 to yourset in |
| 195 |
group2, you would have to issue the following command: |
| 196 |
|
| 197 |
+# cset proc --move --pid=50 --fromset=/group1/myset --toset=/group2/yourset+ |
| 198 |
|
| 199 |
You do not have to worry about where in the Linux filesystem the |
| 200 |
cpuset filesystem is mounted. The cset command takes care of that. |
| 201 |
Any cpusets that are specified by path (such as above), are done with |
| 202 |
respect to the root of the cpuset filesystem. |
| 203 |
|
| 204 |
LICENSE |
| 205 |
------- |
| 206 |
Cpuset is licensed under the GNU GPL V2 only. |
| 207 |
|
| 208 |
COPYRIGHT |
| 209 |
--------- |
| 210 |
Copyright (c) 2008-2011 Novell Inc. |
| 211 |
|
| 212 |
AUTHOR |
| 213 |
------ |
| 214 |
Written by Alex Tsariounov <\[email protected]>. |
| 215 |
|
| 216 |
SEE ALSO |
| 217 |
-------- |
| 218 |
cset(1), cset-set(1), cset-shield(1) |
| 219 |
|
| 220 |
/usr/share/doc/packages/cpuset/html/tutorial.html |
| 221 |
|
| 222 |
taskset(1), chrt(1) |
| 223 |
|
| 224 |
/usr/src/linux/Documentation/cpusets.txt |