Cpuset Management Utilty/proc writeup

From RTwiki
(Difference between revisions)
Jump to: navigation, search
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Cpuset management utility | Back up to the cpuset page]]
+
[[Cpuset Management Utility | Back up to the cpuset page]]
  
==Usage: <code>cset proc [options] [path/program [args]</code>==
+
Version 1.5.0
  
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 — use the standard OS ^C or kill commands for that.
+
==Usage: <code>cset proc [options] [path/program [args]]</code>==
  
To list which tasks are running in a particular cpuset, use the --list command.
+
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 -- use the standard OS ^C or kill
 +
commands for that.
 +
 
 +
To list which tasks are running in a particular cpuset, use the
 +
--list command.
  
 
For example:
 
For example:
 +
    # cset proc --list --set myset
 +
        This command will list all the tasks running in the
 +
        cpuset called "myset".
  
    # cset proc --list --set priset
+
Processes are created by specifying the path to the executable
 +
and specifying the cpuset that the process is to be created in.
  
This command will list all the tasks running in the cpuset called "priset".
+
For example:
 +
    # cset proc --set=blazing_cpuset --exec /usr/bin/fast_code
 +
        This command will execute the /usr/bin/fast_code program
 +
        on the "blazing_cpuset" cpuset.
  
Processes are created by specifying the path to the executable and specifying the cpuset that the process is to be created in.
+
Note that if your command takes options, then use the traditional
 +
"--" marker to separate cset's options from your command's
 +
options.
  
 
For example:
 
For example:
 +
    # cset proc --set myset --exec -- ls -l
 +
        This command will execute "ls -l" on the cpuset called
 +
        "myset".
  
    # cset proc --exec --set=blazing_cpuset /usr/bin/fast_code
+
The PIDSPEC argument taken for the move command is a comma
 
+
separated list of PIDs or TIDs. The list can also include
This command will execute the /usr/bin/fast_code program on the "blazing_cpuset" cpuset.
+
brackets of PIDs or TIDs (i.e. tasks) that are inclusive of the
 
+
endpoints.
The move command accepts multiple common calling methods. 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.
+
  
 
For example:
 
For example:
 
 
     1,2,5              Means processes 1, 2 and 5
 
     1,2,5              Means processes 1, 2 and 5
 
     1,2,600-700        Means processes 1, 2 and from 600 to 700
 
     1,2,600-700        Means processes 1, 2 and from 600 to 700
  
Note that 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.
+
Note that 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.
  
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.
+
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.
  
 +
The move command accepts multiple common calling methods.
 
For example, the following commands are equivalent:
 
For example, the following commands are equivalent:
 +
  # cset proc --move 2442,3000-3200 reserved_set
 +
  # cset proc --move --pid=2442,3000-3200 --toset=reserved_set
 +
      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".
  
    # cset proc --move 2442,3000-3200 reserved_set
+
Specifying the --fromset is not necessary since the tasks will be
    # cset proc --move --pid=2442,3000-3200 --toset=reserved_set
+
moved to the destination cpuset no matter which cpuset they are
 +
currently running on.
  
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".
+
Note however that if you do specify a cpuset with the --fromset
 +
option, then only those tasks that are both in the PIDSPEC *and*
 +
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.
  
Specifying the --fromset is not necesary since the tasks will be moved to the destination cpuset no matter which cpuset they are currently running on.
+
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.
  
Note however that if you do specify a cpuset with the --fromset option, then only those tasks that are both in the PIDSPEC *and* 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.
+
To move all userspace tasks from one cpuset to another, you need
 
+
to specify the source and destination cpuset by name.
To move all userspace tasks from one cpuset to another, you need to specify the source and destination cpuset by name.
+
  
 
For example:
 
For example:
 
 
     # cset proc --move --fromset=comp1 --toset=comp42
 
     # cset proc --move --fromset=comp1 --toset=comp42
 +
        This command specifies that all processes and threads
 +
        running on cpuset "comp1" be moved to cpuset "comp42".
  
This command specifies that all processes and threads running on cpuset "comp1" be moved to cpuset "comp42".
+
Note that the 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 also specify the
 +
--force switch, then all tasks, kernel or not, bound or not,
 +
will be moved.
  
Note that the 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 also specify the -a/--all switch, then all tasks, kernel or not, bound or not, will be moved.
+
CAUTION: 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.
  
CAUTION: Please be cautious with the --all 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.
+
You must specify unique cpuset names for the both exec and move
 
+
commands. If a simple name passed to the --fromset, --toset and
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.
+
--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.
  
 
For example, suppose you have the following cpuset tree:
 
For example, suppose you have the following cpuset tree:
 
 
     /group1
 
     /group1
 
         /myset
 
         /myset
Line 66: Line 113:
 
         /yourset
 
         /yourset
  
Then, to move a process from myset in group1 to yourset in group2, you would have to issue the following command:
+
Then, to move a process from myset in group1 to yourset in
    # cset proc --move --pid=50 --fromset=/group1/myset \
+
group2, you would have to issue the following command:
    --toset=/group2/yourset
+
    # cset proc --move --pid=50 --fromset=/group1/myset \
 +
            --toset=/group2/yourset
  
 
===Options:===
 
===Options:===
<code>
+
 
 
   -l, --list            list processes in the specified cpuset
 
   -l, --list            list processes in the specified cpuset
   -e, --exec            execute arguments in the specified cpuset
+
   -e, --exec            execute arguments in the specified cpuset; use the
 +
                        "--" option separator to separate cset options from
 +
                        your exec'ed command options
 
   -u USER, --user=USER  use this USER to --exec (id or name)
 
   -u USER, --user=USER  use this USER to --exec (id or name)
 
   -g GROUP, --group=GROUP
 
   -g GROUP, --group=GROUP
Line 79: Line 129:
 
   -m, --move            move specified tasks to specified cpuset; to move a
 
   -m, --move            move specified tasks to specified cpuset; to move a
 
                         PIDSPEC to a cpuset, use -m PIDSPEC cpuset; to move
 
                         PIDSPEC to a cpuset, use -m PIDSPEC cpuset; to move
                         all tasks specify --fromset and --toset
+
                         all tasks only specify --fromset and --toset
 
   -p PIDSPEC, --pid=PIDSPEC
 
   -p PIDSPEC, --pid=PIDSPEC
                         specify pid or tid specification
+
                         specify pid or tid specification for move
 +
  --threads            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
 
   -s CPUSET, --set=CPUSET
 
   -s CPUSET, --set=CPUSET
 
                         specify name of immediate cpuset
 
                         specify name of immediate cpuset
Line 89: Line 143:
 
                         specify name of origination cpuset
 
                         specify name of origination cpuset
 
   -k, --kthread        move, or include moving, unbound kernel threads
 
   -k, --kthread        move, or include moving, unbound kernel threads
   -a, --all            force all processes and threads to be moved
+
   --force              force all processes and threads to be moved
 
   -v, --verbose        prints more detailed output, additive
 
   -v, --verbose        prints more detailed output, additive
 
   -h, --help            show this help message and exit
 
   -h, --help            show this help message and exit
</code>
+
 
 
----
 
----
  
[[Cpuset management utility | Back up to cpuset page.]]
+
[[Cpuset Management Utility | Back up to cpuset page.]]

Latest revision as of 19:40, 6 September 2011

Back up to the cpuset page

Version 1.5.0

[edit] Usage: cset proc [options] [path/program [args]]

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 -- use the standard OS ^C or kill commands for that.

To list which tasks are running in a particular cpuset, use the --list command.

For example:

   # cset proc --list --set myset
       This command will list all the tasks running in the
       cpuset called "myset".

Processes are created by specifying the path to the executable and specifying the cpuset that the process is to be created in.

For example:

   # cset proc --set=blazing_cpuset --exec /usr/bin/fast_code 
       This command will execute the /usr/bin/fast_code program
       on the "blazing_cpuset" cpuset.

Note that if your command takes options, then use the traditional "--" marker to separate cset's options from your command's options.

For example:

   # cset proc --set myset --exec -- ls -l
       This command will execute "ls -l" on the cpuset called
       "myset".

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.

For example:

   1,2,5               Means processes 1, 2 and 5
   1,2,600-700         Means processes 1, 2 and from 600 to 700

Note that 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.

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.

The move command accepts multiple common calling methods. For example, the following commands are equivalent:

  # cset proc --move 2442,3000-3200 reserved_set
  # cset proc --move --pid=2442,3000-3200 --toset=reserved_set
      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".

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.

Note however that if you do specify a cpuset with the --fromset option, then only those tasks that are both in the PIDSPEC *and* 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.

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.

To move all userspace tasks from one cpuset to another, you need to specify the source and destination cpuset by name.

For example:

   # cset proc --move --fromset=comp1 --toset=comp42
       This command specifies that all processes and threads
       running on cpuset "comp1" be moved to cpuset "comp42".

Note that the 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 also specify the --force switch, then all tasks, kernel or not, bound or not, will be moved.

CAUTION: 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.

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.

For example, suppose you have the following cpuset tree:

   /group1
       /myset
       /yourset
   /group2
       /myset
       /yourset

Then, to move a process from myset in group1 to yourset in group2, you would have to issue the following command:

   # cset proc --move --pid=50 --fromset=/group1/myset \
           --toset=/group2/yourset

[edit] Options:

 -l, --list            list processes in the specified cpuset
 -e, --exec            execute arguments in the specified cpuset; use the
                       "--" option separator to separate cset options from
                       your exec'ed command options
 -u USER, --user=USER  use this USER to --exec (id or name)
 -g GROUP, --group=GROUP
                       use this GROUP to --exec (id or name)
 -m, --move            move specified tasks to specified cpuset; to move a
                       PIDSPEC to a cpuset, use -m PIDSPEC cpuset; to move
                       all tasks only specify --fromset and --toset
 -p PIDSPEC, --pid=PIDSPEC
                       specify pid or tid specification for move
 --threads             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
 -s CPUSET, --set=CPUSET
                       specify name of immediate cpuset
 -t TOSET, --toset=TOSET
                       specify name of destination cpuset
 -f FROMSET, --fromset=FROMSET
                       specify name of origination cpuset
 -k, --kthread         move, or include moving, unbound kernel threads
 --force               force all processes and threads to be moved
 -v, --verbose         prints more detailed output, additive
 -h, --help            show this help message and exit

Back up to cpuset page.

Personal tools