plgrp - observe and affect home lgroup and lgroup affinities of threads

NAME

plgrp - observe and affect home lgroup and lgroup affinities of threads


SYNOPSIS


  plgrp [-F] [-h] <pid> | <core> [/<lwps>] ...

  plgrp [-F] -a <lgroup list> <pid>[/<lwps>] ...
  plgrp [-F] -H <lgroup list> <pid>[/<lwps>] ...
  plgrp [-F] -A <lgroup list>/<none|weak|strong>[,...] <pid>[/<lwps>] ...

DESCRIPTION

The plgrp utility can display or set the home lgroup and lgroup affinities for one or more processes and/or threads/lwps.

An lgroup represents the set of CPU and memory-like hardware devices that are at most some distance (latency) apart from each other. Each lgroup in the system is identified by a unique lgroup ID. The lgroups are organized into a hierarchy to facilitate finding the nearest resources (see lgrpinfo(1) for more about lgroups and the lgroup hierarchy).

By default, each thread is assigned a home lgroup upon creation. When the system needs to allocate a CPU or memory resource for a thread, it searches the lgroup hierarchy from the thread's home lgroup for the nearest available resources to the thread's home.

Typically, the home lgroup for a thread is the lgroup for which the thread has the most affinity. Initially, the system chooses a home lgroup for each thread, but leaves the thread's affinity for that lgroup set to none. If a thread sets a stronger affinity for an lgroup in its processor set other than its home, the thread is rehomed to that lgroup as long as the thread is not bound to a CPU. The thread may be rehomed to the lgroup in its processor set with the next highest affinity when the affinity (if any) for its home lgroup is removed (set to none).

The different levels of lgroup affinities and their semantics are fully described in lgrp_affinity_set(3LGRP).

OPTIONS

The following options are supported:

-a <lgroup list>

Displays lgroup affinities of specified process(es) or thread(s) for the given lgroups.

-A <lgroup list>/<none|weak|strong>[,...]

Sets affinity of specified process(es) or thread(s) to given lgroups. A comma separated list of <lgroups>/<affinity> assignments can be given to set several affinities at once.

-F

Force. Grabs the target process even if another process has control.

Caution should be exercised when using the -F flag. Imposing two controlling processes on one victim process can lead to chaos. Safety is assured only when the primary controlling process (typically a debugger) has stopped the victim process, but isn't doing anything during the application of this proc tool. See WARNINGS for more details.

-h

Get home lgroup of specified process(es) and/or thread(s). This is the default when no options are given.

-H <lgroup list>

Sets home lgroup of specified process(es) and/or thread(s).

This sets a strong affinity for the desired lgroup to rehome the thread(s). If more than one lgroup is specified, the plgrp utility will try to home the threads to the lgroups in a round robin fashion.


USAGE

Specifying lgroups

The <lgroup list> is a comma separated list of one or more of the following:


    - lgroup ID
    - Range of lgroup IDs specified as
        <start lgroup ID>-<end lgroup ID>
    - "all"
    - "root"
    - "leaves"

The all keyword represents all lgroup IDs in the system, the root keyword represents the ID of the root lgroup and the leaves keyword represents the IDs of all leaf lgroups (ie. lgroups which do not have any children).

Specifying process and thread arguments

The plgrp utility takes one or more space separated processes or threads as arguments. Processes and threads can be specified in a manner similiar to the proc(1) tools. A process ID may be specified as an integer <pid> or /proc/<pid>. Shell expansions may be used to specify processes when /proc/<pid> is used. For example, /proc/* can be used to specify all the processes in the system. If a process ID is given alone, then all the threads of the process are included as arguments to plgrp(1).

Threads can be explicitly specified with its process ID and thread ID given together as <pid>/<lwpid>. Multiple threads of a process can be selected at once by using the - and ,. For example, <pid>/1,2,7-9 specifies threads 1, 2, 7, 8, and 9 of the process with <pid> as its process ID.


EXAMPLES

Example 1:
 Getting home lgroup for shell
:
  % plgrp $$
     PID/LWPID    HOME
    3401/1        1
Example 2:
 Setting home lgroup of multiple threads to the root lgroup
:
  % plgrp -H root `pgrep firefox`
     PID/LWPID    HOME
     918/1        1 => 0
     934/1        2 => 0
     934/2        1 => 0
     934/3        2 => 0
     934/625      1 => 0
     934/626      2 => 0
     934/624      2 => 0
     934/623      2 => 0
     934/630      1 => 0
Example 3:
 Getting two threads' affinities for lgroups 0-2
:
  % plgrp -a 0-2 101398/1 101337/1
     PID/LWPID    HOME  AFFINITY
  101398/1        1     0-2/none
  101337/1        1     0-2/none
Example 4:
 Setting lgroup affinities
:
  % plgrp -A 0/weak,1/none,2/strong 101398
     PID/LWPID    HOME       AFFINITY
  101398/1        1 => 2     0,2/none => 2/strong,0/weak

EXIT STATUS

The following exit values are returned:

1.
1.
1.


ATTRIBUTES

See attributes(5) for descriptions of the following attributes:


     {{{____________________________________________________________}}}
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |{{{_____________________________}}}|{{{_____________________________}}}|
    | Availability                |                             |
    |{{{_____________________________}}}|{{{_____________________________}}}|
    | Interface Stability         |                             |
    |{{{_____________________________}}}|{{{_____________________________}}}|
    | Command Syntax              | Unstable                    |
    |{{{_____________________________}}}|{{{_____________________________}}}|
    | Output Format(s)            | Unstable                    |
    |{{{_____________________________}}}|{{{_____________________________}}}|

SEE ALSO

lgrpinfo(1), madv.so.1(1), pmadvise(1), pmap(1), proc(1), prstat(1M), ps(1), lgrp_affinity_get(3LGRP), lgrp_affinity_set(3LGRP), lgrp_home(3LGRP), liblgrp(3LIB), proc(4)


WARNINGS

Like proc(1) tools, the plgrp utility stops its target processeswhile inspecting them and reporting the results when invoked with any option.

There are conditions under which processes may deadlock (see proc(1) for more details). A process can do nothing while it is stopped. Stopping a heavily used process in a production environment (even for a short amount of time) can cause severe bottlenecks and even hangs of these processes, making them to be unavailable to users. Thus, stopping a UNIX process in a production environment should be avoided.

A process being stopped by this tool can be identified by issuing /usr/bin/ps -eflL and looking for T in the first column. Notice that certain processes, for example, sched, can show the T status by default most of the time.

 plgrp - observe and affect home lgroup and lgroup affinities of threads
last modified by admin on 2009/10/26 12:10
Collectives
Project


© Sun Microsystems Inc. 2009
XWiki Enterprise 1.8.2.19075 - Documentation
Terms Of Use | Privacy | Trademarks | Copyright Policy | Site Guidelines | Site map | Help
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Use.