Add prior version 1.5.0 to repo.

python3 rel_1.5.0
Alex Tsariounov 15 years ago
parent a2e80c6ca6
commit 370b2333ed

@ -1,3 +1,5 @@
Building Cpuset from Source
===========================
This is a distutils-based package and as such, it contains
a number of differnet installation methods. By far the most
convenient is to create an rpm. This rpm can then be later
@ -12,7 +14,7 @@ For basic installation:
python setup.py install
By default, the above command installs cpuset in the
$HOME/{bin,lib,share} directories. For a different location,
/usr/local/{bin,lib,share} directories. For a different location,
use the --prefix option:
python setup.py install --prefix=/usr
@ -20,3 +22,10 @@ use the --prefix option:
For more information:
http://docs.python.org/inst/inst.html
Prebuild Binary Packages
========================
Alternatively, you may download pre-built binary packages for multiple
distributions from the OpenSUSE Build Service here:
http://download.opensuse.org/repositories/home:/tsariounov:/cpuset

@ -4,15 +4,15 @@ INSTALL
MANIFEST
MANIFEST.in
Makefile
NEWS
README
TODO
cset
setup.cfg
setup.py
cpuset/__init__.py
cpuset/config.py
cpuset/cset.py
cpuset/main.py
cpuset/task.py
cpuset/util.py
cpuset/version.py
cpuset/commands/__init__.py
@ -37,5 +37,6 @@ doc/cset.1
doc/cset.html
doc/cset.txt
doc/tutorial.conf
doc/tutorial.html
doc/tutorial.txt
t/README

@ -1,3 +1,3 @@
include README Makefile MANIFEST MANIFEST.in AUTHORS COPYING INSTALL ChangeLog TODO
include README Makefile MANIFEST MANIFEST.in AUTHORS COPYING INSTALL NEWS ChangeLog TODO
include t/README
include doc/*.txt doc/Makefile doc/*.conf doc/callouts.xsl doc/*.1 doc/*.html

79
NEWS

@ -0,0 +1,79 @@
============================================================
Cpuset 1.5.0 (February 7, 2009)
https://forgesvn1.novell.com/svn/cpuset/tags/rel_1.5.0
http://download.opensuse.org/repositories/home:/tsariounov:/cpuset/
Major upgrade since 1.04. This release includes a number of bug fixes and
enhancements as outlined below. The release number also has transitioned to a
three-digit number. This release has many usability enhancements from the
past months experience. It also includes a lengthy tutorial to introduce
users to the tool.
The bug numbers refer to cpuset's bugzilla instance which can be found
here: http://devzilla.novell.com/cpuset
Fixed Bugs:
* Fix bug #1: Origination cpuset not accepted for process move...
* Fix bug #2: Proc move from set to set does not recognize...
* Fix bug #3: Interspersed arguments do not work
* Fix bug #4: Add policy and priority to proc output list
* Fix bug #5: Add ability to move all threads in a process container wi.
* Fix bug #6: The -a option for set listing should be the default
* Fix bug #7: Add destination cpuset for the proc move command
* Fix bug #8: Let leading slash for nested cpuset spec be optional
* Fix bug #9: Rearrange info output some, include machine readable output
* Fix bug #10: Add a recursive cpuset delete with option
* Fix bug #11: Add a configuration file
* Fix bug #12: Add hex mask output for cpuset definition spec (cpuspec)
* Fix bug #13: Add cpuset rename option to set command
* Fix bug #21: Create shield shortcuts
Other fixes:
* Changed behavior of shield command, now it behaves more like the proc move
command: -s or -u needs a -p to shield or unshield, however, the shortcut of
shield pidspec still works.
* Fixed exception when using cset with pipes
* Fixed set list behavior if --set was specified but not --list
* Added error message if proc list command does not specify a set
* Fixed exception if proc is used with -l and -s
* Location for cpuset filesystem mount can be specified in config file
* Changed proc option -a/--all to --force only
* Updated copyrights, URLs and documentation
* Added spec file to svn which is used in build service
* Cleaned up status output for clarity and consistency
* Additional minor corner case bug fixes included
============================================================
Cpuset 1.04 (September 2, 2008)
https://forgesvn1.novell.com/svn/cpuset/tags/rel_1.04
http://download.opensuse.org/repositories/home:/tsariounov:/cpuset/
Minor bug fixes and inclusion in SLERT10SP2 and slotted for SLES11.
============================================================
Cpuset 1.03 (July 18, 2008)
https://forgesvn1.novell.com/svn/cpuset/tags/rel_1.03
http://download.opensuse.org/repositories/home:/tsariounov:/cpuset/
Fixed class variables that made import of cset.as python library possible.
============================================================
Cpuset 1.02 (June 10, 2008)
https://forgesvn1.novell.com/svn/cpuset/tags/rel_1.02
http://download.opensuse.org/repositories/home:/tsariounov:/cpuset/
Minor fixes.
============================================================
Cpuset 1.0 (May 30, 2008)
https://forgesvn1.novell.com/svn/cpuset/tags/rel_1.0
http://download.opensuse.org/repositories/home:/tsariounov:/cpuset/
First full-featured public release complete with man pages and html docs.
============================================================

@ -2,17 +2,23 @@ Cpuset is a Python application that forms a wrapper around the
standard Linux filesystem calls to make using the cpusets facilities
in the Linux kernel easier.
For the latest version see http://opensuse.org/build_service/cpuset
Bugs or feature requests should be sent to http://bugs.opensuse.org
For the latest version see:
http://developer.novell.com/wiki/index.php/cpuset
For packages, see the OpenSUSE build service:
http://download.opensuse.org/repositories/home:/tsariounov:/Cpuset
Bugs or feature requests should be sent to:
http://devzilla.novell.com/cpuset/
-----
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 only as
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,

@ -0,0 +1,82 @@
#
# spec file for package cpuset (Version 1.04)
#
# Copyright (c) 2008 Novell, Inc. Waltham, MA, USA
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://devzilla.novell.com/cpuset
#
# norootforbuild
Name: cpuset
Version: 1.5.0
Release: 1
License: GPL v2 only
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://developer.novell.com/wiki/index.php/Cpuset
Group: System/Management
Summary: Allows manipulation of cpusets on system and provides higher level functions
Source: %{name}-%{version}.tar.gz
BuildRequires: python-devel
%if 0%{?suse_version} > 0
%py_requires
%endif
%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%description
Cpuset is a Python application to make using the cpusets facilities in
the Linux kernel easier. The actual included command is called cset
and it allows manipulation of cpusets on the system and provides higher
level functions such as implementation and control of a basic cpu
shielding setup.
Authors:
--------
Alex Tsariounov <alext@novell.com>
%prep
%setup
%build
CFLAGS="%{optflags}" \
%{__python} setup.py build
#make doc ->not yet, asciidoc is missing...
%install
# Install binaries, but do not install docs via setup.py
%{__python} setup.py install --root=%{buildroot} --prefix=%{_prefix} --install-data=/eraseme
%{__rm} -rf %{buildroot}/eraseme
# Install documentation
%{__mkdir_p} %{buildroot}/%{_defaultdocdir}/cpuset
%{__cp} NEWS README INSTALL AUTHORS COPYING %{buildroot}/%{_defaultdocdir}/cpuset/
%{__mkdir_p} %{buildroot}/%{_mandir}/man1
cd doc
%{__gzip} *.1
%{__cp} *.1.gz %{buildroot}/%{_mandir}/man1
%{__cp} *.txt %{buildroot}/%{_defaultdocdir}/cpuset/
%{__mkdir} %{buildroot}/%{_defaultdocdir}/cpuset/html
%{__cp} *.html %{buildroot}/%{_defaultdocdir}/cpuset/html/
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%{_bindir}/cset
%{python_sitelib}/*
%{_mandir}/man1/*
%{_defaultdocdir}/*
%changelog

@ -1,5 +1,5 @@
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify

@ -1,5 +1,5 @@
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify

@ -2,7 +2,7 @@
"""
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify

@ -2,7 +2,7 @@
"""
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify

@ -2,7 +2,7 @@
"""
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
@ -22,11 +22,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import sys, os, re, logging, pwd, grp
from optparse import OptionParser, make_option
from cpuset import config
from cpuset import cset
from cpuset.util import *
from cpuset.commands.common import *
try: from cpuset.commands import set
except: pass
except SyntaxError:
raise
except:
pass
global log
log = logging.getLogger('proc')
@ -44,9 +48,9 @@ To list which tasks are running in a particular cpuset, use the
--list command.
For example:
# cset proc --list --set priset
# cset proc --list --set myset
This command will list all the tasks running in the
cpuset called "priset".
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.
@ -56,6 +60,15 @@ For example:
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
@ -83,7 +96,7 @@ For example, the following commands are equivalent:
running task between 3000 and 3200 inclusive of the ends
to the cpuset called "reserved_set".
Specifying the --fromset is not necesary since the tasks will be
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.
@ -93,6 +106,12 @@ 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.
@ -105,11 +124,11 @@ 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,
--force switch, then all tasks, kernel or not, bound or not,
will be moved.
CAUTION: Please be cautious with the --all switch, since moving a
kernel thread that is bound to a specific CPU to a cpuset that
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
@ -138,7 +157,9 @@ options = [make_option('-l', '--list',
help = 'list processes in the specified cpuset',
action = 'store_true'),
make_option('-e', '--exec',
help = 'execute arguments in the specified cpuset',
help = 'execute arguments in the specified cpuset; '
'use the "--" option separator to separate '
'cset options from your exec\'ed command options',
dest = 'exc',
action = 'store_true'),
make_option('-u', '--user',
@ -148,11 +169,17 @@ options = [make_option('-l', '--list',
make_option('-m', '--move',
help = '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',
'to move all tasks only specify --fromset and --toset',
action = 'store_true'),
make_option('-p', '--pid',
metavar = 'PIDSPEC',
help = 'specify pid or tid specification'),
help = 'specify pid or tid specification for move'),
make_option("--threads",
help = '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',
action = 'store_true'),
make_option('-s', '--set',
metavar = 'CPUSET',
help = 'specify name of immediate cpuset'),
@ -163,7 +190,7 @@ options = [make_option('-l', '--list',
make_option('-k', '--kthread',
help = 'move, or include moving, unbound kernel threads',
action = 'store_true'),
make_option('-a', '--all',
make_option('--force',
help = 'force all processes and threads to be moved',
action = 'store_true'),
make_option('-v', '--verbose',
@ -186,9 +213,11 @@ def func(parser, options, args):
elif options.toset:
tset = cset.unique_set(options.toset)
elif len(args) > 0:
tset = cset.unique_set(args[0])
if options.exc: del args[0]
else: tset = args
if options.exc:
tset = cset.unique_set(args[0])
del args[0]
else:
tset = args
else:
raise CpusetException("cpuset not specified")
try:
@ -203,57 +232,84 @@ def func(parser, options, args):
return
if options.move or options.kthread:
# first, we need to know the destination
fset = None
tset = None
# first, we need to know the destination
if options.toset:
tset = cset.unique_set(options.toset)
elif options.set:
elif options.set and options.pid:
tset = cset.unique_set(options.set)
elif options.set and options.fromset:
tset = cset.unique_set(options.set)
elif len(args) > 0:
if len(args) > 1 and options.pid == None:
options.pid = args[0]
tset = cset.unique_set(args[1])
if len(args) < 3:
tset = cset.unique_set(args[1])
else:
# "-m 123 set1 set2" shortcut
fset = cset.unique_set(args[1])
tset = cset.unique_set(args[2])
# take care of set1->set2 shortcut
pids = pidspec_to_list(options.pid, threads=options.threads)
if len(pids) == 1:
try:
fset = cset.unique_set(pids[0])
options.pid = None
except:
pass # must be real pidspec
else:
tset = cset.unique_set(args[0])
if len(args) < 2:
tset = cset.unique_set(args[0])
else:
fset = cset.unique_set(args[0])
tset = cset.unique_set(args[1])
else:
raise CpusetException("destination cpuset not specified")
set.active(tset)
# next, if there is a pidspec, move just that
if options.pid:
fset = None
if options.fromset and not options.all:
if options.fromset and not options.force:
fset = cset.unique_set(options.fromset)
pids = pidspec_to_list(options.pid, fset)
elif options.toset and options.set:
fset = cset.unique_set(options.set)
pids = pidspec_to_list(options.pid, fset, options.threads)
if len(pids):
l = []
l.append('--> moving following pidspec: %s' % options.pid)
l.extend(task_detail_header(' '))
l.extend(task_detail_table(pids, ' ', 76))
log.info("\n".join(l))
selective_move(None, tset, pids, options.kthread, options.all)
log.info('moving following pidspec: %s' % ','.join(pids))
selective_move(None, tset, pids, options.kthread, options.force)
else:
log.info('**> no tasks moved')
log.info('done')
else:
fset = None
# here we assume move everything from fromset to toset
if options.fromset == None:
if options.fromset:
fset = cset.unique_set(options.fromset)
elif options.set:
fset = cset.unique_set(options.set)
elif len(args) > 0:
# this must be the fromset, then...
fset = cset.unique_set(args[0])
if fset == None:
raise CpusetException("origination cpuset not specified")
fset = cset.unique_set(options.fromset)
nt = len(fset.tasks)
if nt == 0:
raise CpusetException('no tasks to move from cpuset "%s"'
% fset.path)
if options.move:
log.info('--> moving all tasks from "%s" to "%s"...',
fset.path, tset.path)
selective_move(fset, tset, None, options.kthread, options.all)
log.info('moving all tasks from %s to %s',
fset.name, tset.path)
selective_move(fset, tset, None, options.kthread, options.force,
options.threads)
else:
log.info('--> moving all kernel threads from "%s" to "%s"...',
log.info('moving all kernel threads from %s to %s',
fset.path, tset.path)
# this is a -k "move", so only move kernel threads
pids = []
for task in fset.tasks:
try: os.readlink('/proc/'+task+'/exe')
except: pids.append(task)
selective_move(fset, tset, pids, options.kthread, options.all)
selective_move(fset, tset, pids, options.kthread, options.force)
log.info('done')
return
@ -261,22 +317,40 @@ def func(parser, options, args):
list_sets(args)
def list_sets(args):
log.debug("entering list_sets, args=%s", args)
l = []
if isinstance(args, list):
for s in args: l.extend(cset.find_sets(s))
for s in args:
if isinstance(s, str):
l.extend(cset.find_sets(s))
elif not isinstance(s, cset.CpuSet):
raise CpusetException(
'list_sets() args=%s, of which "%s" not a string or CpuSet'
% (args, s))
else:
l.append(s)
else:
l.extend(cset.find_sets(args))
if isinstance(args, str):
l.extend(cset.find_sets(args))
elif not isinstance(args, cset.CpuSet):
raise CpusetException(
"list_sets() passed args=%s, which is not a string or CpuSet" % args)
else:
l.append(args)
if len(l) == 0:
raise CpusetException("cpuset(s) to list not specified");
for s in l:
if len(s.tasks) > 0:
if verbose:
log_detailed_task_table(s, ' ')
log_detailed_task_table(s, ' ')
else:
log_detailed_task_table(s, ' ', 76)
log_detailed_task_table(s, ' ', 78)
else:
log.info(cset.summary(s))
def move(fromset, toset, plist=None):
log.debug('entering move, fromset=%s toset=%s list=%s', fromset, toset, plist)
def move(fromset, toset, plist=None, verb=None, force=None):
log.debug('entering move, fromset=%s toset=%s list=%s force=%s verb=%s',
fromset, toset, plist, force, verb)
if isinstance(fromset, str):
fset = cset.unique_set(fromset)
elif not isinstance(fromset, cset.CpuSet) and plist == None:
@ -293,17 +367,39 @@ def move(fromset, toset, plist=None):
tset = toset
if plist == None:
log.debug('moving default of all processes')
tset.tasks = fset.tasks
else:
tset.tasks = plist
if tset != fset and not force:
plist = fset.tasks
else:
raise CpusetException(
"cannot move tasks into their origination cpuset")
output = 0
if verb:
output = verb
elif verbose:
output = verbose
if output:
l = []
if config.mread:
l.append('move_tasks_start')
l.extend(task_detail_table(plist))
l.append('move_tasks_stop')
else:
l.append(' ')
l.extend(task_detail_header(' '))
if output > 1:
l.extend(task_detail_table(plist, ' '))
else:
l.extend(task_detail_table(plist, ' ', 76))
log.info("\n".join(l))
# do the move...
tset.tasks = plist
def selective_move(fset, tset, plist=None, kthread=None, force=None):
def selective_move(fset, tset, plist=None, kthread=None, force=None, threads=None):
log.debug('entering selective_move, fset=%s tset=%s plist=%s kthread=%s force=%s',
fset, tset, plist, kthread, force)
target = cset.unique_set(tset)
task_check = []
tasks = []
task_heap = []
task_check = []
utsk = 0
ktsk = 0
autsk = 0
@ -311,12 +407,19 @@ def selective_move(fset, tset, plist=None, kthread=None, force=None):
utsknr = 0
ktsknr = 0
ktskb = 0
sstsk = 0
target = cset.unique_set(tset)
if fset:
task_check = cset.unique_set(fset).tasks
fset = cset.unique_set(fset)
if fset == target and not force:
raise CpusetException(
"error, same source/destination cpuset, use --force if ok")
task_check = fset.tasks
if plist:
task_heap = plist
else:
task_heap = cset.unique_set(fset).tasks
log.debug('processing task heap')
for task in task_heap:
try:
# kernel threads do not have an excutable image
@ -326,15 +429,30 @@ def selective_move(fset, tset, plist=None, kthread=None, force=None):
try:
task_check.index(task)
tasks.append(task)
log.debug(' added task %s', task)
utsk += 1
except:
if threads:
log.debug(' thread matching, looking for threads for task %s', task)
dirs = os.listdir('/proc/'+task+'/task')
if len(dirs) > 1:
for thread in dirs:
if thread != task:
log.debug(' adding thread %s', thread)
tasks.append(thread)
utsk += 1
except ValueError:
log.debug(' task %s not running in %s, skipped',
task, fset.name)
utsknr += 1
else:
tasks.append(task)
utsk += 1
except:
if not force and cset.lookup_task_from_cpusets(task) == target.path:
log.debug(' task %s moving to orgination set %s, skipped',
task, target.path)
sstsk += 1
else:
tasks.append(task)
utsk += 1
except OSError:
aktsk += 1
try:
# this is in try because the task may not exist by the
@ -347,6 +465,10 @@ def selective_move(fset, tset, plist=None, kthread=None, force=None):
if is_unbound(task):
tasks.append(task)
ktsk += 1
elif cset.lookup_task_from_cpusets(task) == target.path:
log.debug(' task %s moving to orgination set %s, skipped',
task, target.path)
sstsk += 1
else:
log.debug(' kernel thread %s is bound, not adding',
task)
@ -356,31 +478,44 @@ def selective_move(fset, tset, plist=None, kthread=None, force=None):
task)
ktsknr += 1
# ok, move 'em
log.debug('moving %d tasks to "%s"...', len(tasks), tset.name)
log.debug('moving %d tasks to %s ...', len(tasks), tset.name)
if len(tasks) == 0:
log.info('** no task matched move criteria')
if autsk > 0:
log.info('**> no task matched move criteria')
if sstsk > 0:
raise CpusetException('same source/destination cpuset, use --force if ok')
elif len(task_heap) > 0 and not kthread:
raise CpusetException('if you want to move kernel threads, use -k')
elif ktskb > 0:
raise CpusetException('kernel tasks are bound, use --force if ok')
return
if utsk > 0:
l = []
l.append('moving')
l.append(str(utsk))
l.append('userspace tasks')
if utsknr > 0:
l.append('- not moving')
l.append(str(utsknr))
l.append('tasks (not in fromset)')
l.append('userspace tasks to')
l.append(tset.path)
log.info(' '.join(l))
if utsknr > 0:
l = []
l.append('--> not moving')
l.append(str(utsknr))
l.append('tasks (not in fromset, use --force)')
log.info(' '.join(l))
if ktsk > 0 or kthread:
l = []
l.append('moving')
l.append(str(ktsk))
l.append('kernel threads')
if ktskb > 0:
l.append('- not moving')
l.append(str(ktskb))
l.append('threads (not unbound)')
l.append('kernel threads to:')
l.append(tset.path)
log.info(' '.join(l))
if ktskb > 0:
l = []
l.append('--> not moving')
l.append(str(ktskb))
l.append('threads (not unbound, use --force)')
log.info(' '.join(l))
if aktsk > 0 and force and not kthread and autsk == 0:
log.info('** not moving kernel threads since both --all and --kthread needed')
log.info('*** not moving kernel threads, need both --force and --kthread')
if ktsknr > 0:
l = []
l.append('--> not moving')
@ -399,8 +534,8 @@ def run(tset, args, usr_par=None, grp_par=None):
log.debug('entering run, set=%s args=%s ', s.path, args)
set.active(s)
# check user
if usr_par:
try:
if usr_par:
try:
user = pwd.getpwnam(usr_par)[2]
except KeyError:
try:
@ -434,8 +569,10 @@ def run(tset, args, usr_par=None, grp_par=None):
os.execvp(args[0], args)
def is_unbound(proc):
# FIXME: popen is slow... need to use sched_getaffinity() directly,
# but python doesn't have it... maybe use pyrex to wrap....
# FIXME: popen is slow...
# --> use /proc/<pid>/status -> Cpus_allowed
# int(line.replace(',',''), 16)
# note: delete leading zeros to compare to allcpumask
line = os.popen('/usr/bin/taskset -p ' + str(proc), 'r').readline()
aff = line.split()[-1]
log.debug('is_unbound, proc=%s aff=%s allcpumask=%s',
@ -443,8 +580,10 @@ def is_unbound(proc):
if aff == cset.allcpumask: return True
return False
def pidspec_to_list(pidspec, fset=None):
log.debug('entering pidspecToList, pidspec=%s', pidspec)
def pidspec_to_list(pidspec, fset=None, threads=False):
"""create a list of process ids out of a pidspec"""
log.debug('entering pidspecToList, pidspec=%s fset=%s threads=%s',
pidspec, fset, threads)
if fset:
if isinstance(fset, str): fset = cset.unique_set(fset)
elif not isinstance(fset, cset.CpuSet):
@ -454,6 +593,7 @@ def pidspec_to_list(pidspec, fset=None):
raise CpusetException('pidspec=%s is not a string' % pidspec)
groups = pidspec.split(',')
plist = []
nifs = 0
if fset: chktsk = fset.tasks
log.debug('parsing groups: %s', groups)
for sub in groups:
@ -470,6 +610,7 @@ def pidspec_to_list(pidspec, fset=None):
log.debug(' added single pid: %s', items[0])
except:
log.debug(' task %s not running in %s, skipped', items[0], fset.name)
nifs += 1
else:
plist.append(items[0])
log.debug(' added single pid: %s', items[0])
@ -485,30 +626,76 @@ def pidspec_to_list(pidspec, fset=None):
log.debug(' added task from range: %s', tsk)
except:
log.debug(' task %s not running in %s, skipped', tsk, fset.name)
nifs += 1
else:
plist.extend(rng)
log.debug(' added range of pids from %s-%s: %s', items[0], items[1], rng)
else:
raise CpusetException('pidspec=%s has bad group=%s' % (pidspec, items))
log.debug('returning parsed pid list: %s', plist)
log.info('%s tasks match criteria', len(plist))
log.debug('raw parsed pid list of %s tasks: %s', len(plist), plist)
if nifs > 0:
if nifs > 1: nmsg = "tasks"
else: nmsg = "task"
log.info('**> skipped %s %s, not in origination set "%s"', nifs, nmsg, fset.name)
log.debug('checking for duplicates...')
pdict = {}
dups = 0
for task in plist:
if task in pdict:
dups += 1
continue
pdict[task] = True
log.debug('found %s duplicates', dups)
if threads:
log.debug('thread matching activated, looking for threads...')
dups = 0
hits = 0
for task in pdict.keys():
dirs = os.listdir('/proc/'+str(task)+'/task')
if len(dirs) > 1:
hits += 1
for thread in dirs:
if thread in pdict:
dups += 1
continue
pdict[thread] = True
log.debug('found %s multithreaded containers and %s duplicates', hits, dups)
plist = pdict.keys()
log.debug('returning parsed pid list of %s tasks: %s', len(plist), plist)
return plist
def move_pidspec(pidspec, toset, fset=None):
log.debug('entering move_pidspec, pidspec=%s toset=%s', pidspec, toset)
def move_pidspec(pidspec, toset, fset=None, threads=False):
log.debug('entering move_pidspec, pidspec=%s toset=%s threads=%s', pidspec, toset,
threads)
if not fset:
pids = pidspec_to_list(pidspec)
pids = pidspec_to_list(pidspec, None, threads)
else:
# if fromset is specified, only move tasks that are in pidspec
# and are running in fromset
log.debug('specified fset=%s', fset)
pids = pidspec_to_list(pidspec, fset)
pids = pidspec_to_list(pidspec, fset, threads)
if len(pids) == 0:
raise CpusetException('tasks do not match all criteria, none moved')
move(None, toset, pids)
def task_detail(pid, width=65):
# get task details from /proc
def task_detail(pid, width=70):
# scheduler policy definitions
policy = ['o', 'f', 'r', 'b']
# stat location definitions
statdef = {
'pid': 0,
'name': 1,
'state': 2,
'ppid': 3,
'pgid': 4,
'sid': 5,
'priority': 17,
'nice': 18,
'numthreads': 19,
'rtpriority': 39,
'rtpolicy': 40,
}
# get task details from /proc, stat has rtprio/policy but not uid...
pid = str(pid)
if not os.access('/proc/'+pid, os.F_OK):
raise CpusetException('task "%s" does not exist' % pid)
@ -519,28 +706,49 @@ def task_detail(pid, width=65):
stdict[line.split()[0][:-1]] = line.split(':')[1].strip()
except:
pass # sometimes, we get an extra \n out of this file...
stat = file('/proc/'+pid+'/stat', 'r').readline()
stat = stat.split()
cmdline = file('/proc/'+pid+'/cmdline').readline()
# assume that a zero delimits the cmdline (it does now...)
cmdline = cmdline.replace('\0', ' ')
used = 0
out = pwd.getpwuid(int(stdict['Uid'].split()[0]))[0][:8].ljust(8)
used += 8
out += stdict['Pid'].rjust(6)
used += 6
out += stdict['PPid'].rjust(6)
used += 6
out += stdict['State'].split()[0].center(3)
used += 3
out = []
out.append(pwd.getpwuid(int(stdict['Uid'].split()[0]))[0][:8].ljust(8))
out.append(stdict['Pid'].rjust(5))
out.append(stdict['PPid'].rjust(5))
out2 = []
out2.append(stdict['State'].split()[0])
out2.append(policy[int(stat[statdef['rtpolicy']])])
if stat[statdef['rtpolicy']] == '0':
out2.append('th')
elif stat[statdef['rtpolicy']] == '3':
out2.append('at')
else:
if int(stat[statdef['rtpriority']]) < 10:
out2.append('_')
out2.append(stat[statdef['rtpriority']])
else:
out2.append(stat[statdef['rtpriority']].rjust(2))
out.append(''.join(out2))
try:
os.readlink('/proc/'+pid+'/exe')
#prog = stdict['Name'] + ' '.join(cmdline.split()[1:])
prog = cmdline
except:
prog = '['+stdict['Name']+']'
if width == 0:
out += prog
else:
out += prog[:(width-used)]
out.append(prog)
if config.mread:
l2 = []
for line in out:
l2.append(line.strip())
return ';'.join(l2)
out = ' '.join(out)
if width != 0 and len(out) >= width:
out = out[:width-3] + "..."
return out
@ -548,8 +756,8 @@ def task_detail_header(indent=None):
if indent == None: istr = ""
else: istr = indent
l = []
l.append(istr + 'USER PID PPID S TASK NAME')
l.append(istr + '-------- ----- ----- - ---------')
l.append(istr + 'USER PID PPID SPPr TASK NAME')
l.append(istr + '-------- ----- ----- ---- ---------')
return l
def task_detail_table(pids, indent=None, width=None):
@ -565,8 +773,13 @@ def log_detailed_task_table(set, indent=None, width=None):
log.debug("entering print_detailed_task_table, set=%s indent=%s width=%s",
set.path, indent, width)
l = []
l.append(cset.summary(set))
l.extend(task_detail_header(indent))
l.extend(task_detail_table(set.tasks, indent, width))
if not config.mread:
l.append(cset.summary(set))
l.extend(task_detail_header(indent))
l.extend(task_detail_table(set.tasks, indent, width))
else:
l.append('proc_list_start-' + set.name)
l.extend(task_detail_table(set.tasks))
l.append('proc_list_stop-' + set.name)
log.info("\n".join(l))

@ -2,7 +2,7 @@
"""
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
@ -22,11 +22,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import sys, os, logging
from optparse import OptionParser, make_option
from cpuset import config
from cpuset import cset
from cpuset.util import *
from cpuset.commands.common import *
try: from cpuset.commands import proc
except: pass
except SyntaxError:
raise
except:
pass
global log
log = logging.getLogger('set')
@ -43,7 +47,7 @@ A cpuset is an organizational unit that defines a group of CPUs
and a group of memory nodes where a process or thread (i.e. task)
is allowed to run on. For non-NUMA machines, the memory node is
always 0 (zero) and cannot be set to anything else. For NUMA
machines, the memory node can be set to a similar specifcation
machines, the memory node can be set to a similar specification
as the CPU definition and will tie those memory nodes to that
cpuset. You will usually want the memory nodes that belong to
the CPUs defined to be in the same cpuset.
@ -113,7 +117,7 @@ Create a cpuset that specifies both CPUs and memory nodes:
Note that this command uses the full path method to
specify the name of the new cpuset "/rad/set_one". It
also names the new cpuset implicitily (i.e. no --set
also names the new cpuset implicitly (i.e. no --set
option, although you can use that if you want to). If
the "set_one" name is unique, you can subsequently refer
to is just by that. Memory node 3 is assigned to this
@ -124,8 +128,7 @@ already exist, they will modify them to the new specifications."""
verbose = 0
options = [make_option('-l', '--list',
help = 'list the named cpuset(s); recursive list if also -r; '
'members if also -a',
help = 'list the named cpuset(s); recursive list if also -r',
action = 'store_true'),
make_option('-c', '--cpu',
help = 'create or modify cpuset in the specified '
@ -133,19 +136,26 @@ options = [make_option('-l', '--list',
metavar = 'CPUSPEC'),
make_option('-m', '--mem',
help = 'specify which memory nodes to assign '
'to the created or modified cpuset',
'to the created or modified cpuset (optional)',
metavar = 'MEMSPEC'),
make_option('-n', '--newname',
help = 'rename cpuset specified with --set to NEWNAME'),
make_option('-d', '--destroy',
help = 'destroy specified cpuset',
action = 'store_true'),
make_option('-s', '--set',
metavar = 'CPUSET',
help = 'specify cpuset'),
make_option('-a', '--all',
help = 'also do listing of member cpusets',
action = 'store_true'),
make_option('-r', '--recurse',
help = 'do recursive listing, for use with --list',
help = 'do things recursively, use with --list and --destroy',
action = 'store_true'),
make_option('--force',
help = 'force recursive deletion even if processes are running '
'in those cpusets (they will be moved to parent cpusets)',
action = 'store_true'),
make_option('-x', '--usehex',
help = 'use hexadecimal value for CPUSPEC and MEMSPEC when '
'listing cpusets',
action = 'store_true'),
make_option('-v', '--verbose',
help = 'prints more detailed output, additive',
@ -167,10 +177,10 @@ def func(parser, options, args):
if options.list:
if options.set:
list_sets(options.set, options.recurse, options.all)
list_sets(options.set, options.recurse, options.usehex)
return
if len(args): list_sets(args, options.recurse, options.all)
else: list_sets('root', options.recurse, options.all)
if len(args): list_sets(args, options.recurse, options.usehex)
else: list_sets('root', options.recurse, options.usehex)
return
if options.cpu or options.mem:
@ -178,21 +188,27 @@ def func(parser, options, args):
create_from_options(options, args)
return
if options.newname:
rename_set(options, args)
return
if options.destroy:
if options.set: destroy_sets(options.set)
else: destroy_sets(args)
if options.set: destroy_sets(options.set, options.recurse, options.force)
else: destroy_sets(args, options.recurse, options.force)
return
if options.cpu_exclusive or options.mem_exclusive:
# modification of existing cpusets for exclusivity
# FIXME: modification of existing cpusets for exclusivity
return
# default behavior if no options specified is list
log.debug('no options set, default is listing cpusets')
if len(args): list_sets(args, options.recurse, options.all)
else: list_sets('root', options.recurse, options.all)
if options.set: list_sets(options.set, options.recurse, options.usehex)
elif len(args): list_sets(args, options.recurse, options.usehex)
else: list_sets('root', options.recurse, options.usehex)
def list_sets(tset, recurse=None, members=None):
def list_sets(tset, recurse=None, usehex=False):
"""list cpusets specified in tset as cpuset or list of cpusets, recurse if true"""
log.debug('entering list_sets, tset=%s recurse=%s', tset, recurse)
sl = []
if isinstance(tset, list):
@ -200,51 +216,74 @@ def list_sets(tset, recurse=None, members=None):
else:
sl.extend(cset.find_sets(tset))
log.debug('total unique sets in passed tset: %d', len(sl))
if recurse: members = True
if members:
sl2 = []
for s in sl:
sl2.append(s)
if len(s.subsets) > 0:
sl2.extend(s.subsets)
if recurse:
for node in s.subsets:
for nd in cset.walk_set(node):
sl2.append(nd)
sl = sl2
pl = ['']
pl.extend(set_header(' '))
sl2 = []
for s in sl:
sl2.append(s)
if len(s.subsets) > 0:
sl2.extend(s.subsets)
if recurse:
for node in s.subsets:
for nd in cset.walk_set(node):
sl2.append(nd)
sl = sl2
if config.mread:
pl = ['cpuset_list_start']
else:
pl = ['']
pl.extend(set_header(' '))
for s in sl:
if verbose:
pl.append(set_details(s,' ', 0))
pl.append(set_details(s,' ', None, usehex))
else:
pl.append(set_details(s,' '))
pl.append(set_details(s,' ', 78, usehex))
if config.mread:
pl.append('cpuset_list_end')
log.info("\n".join(pl))
def destroy_sets(sets):
log.debug('enter destroy_sets, sets=%s', sets)
def destroy_sets(sets, recurse=False, force=False):
"""destroy cpusets in list of sets, recurse if true, if force destroy if tasks running"""
log.debug('enter destroy_sets, sets=%s, force=%s', sets, force)
nl = []
try:
nl.extend(sets)
except:
nl.append(sets)
# check that sets passed are ok, will raise if one is bad
sl2 = []
for s in nl:
st = cset.unique_set(s)
sl2.append(st)
if len(st.subsets) > 0:
raise CpusetException('cpuset "%s" has subsets, delete them first'
% st.path)
if not recurse:
raise CpusetException(
'cpuset "%s" has subsets, delete them first, or use --recurse'
% st.path)
elif not force:
raise CpusetException(
'cpuset "%s" has subsets, use --force to destroy'
% st.path)
sl2.extend(st.subsets)
for node in st.subsets:
for nd in cset.walk_set(node):
sl2.append(nd)
# ok, good to go
for s in nl:
if recurse: sl2.reverse()
for s in sl2:
s = cset.unique_set(s)
# skip the root set!!! or you'll have problems...
if s.path == '/': continue
log.info('--> processing cpuset "%s", moving %s tasks to parent "%s"...',
s.name, len(s.tasks), s.parent.path)
proc.move(s, s.parent)
log.info('deleting cpuset "%s"', s.path)
log.info('--> deleting cpuset "%s"', s.path)
destroy(s)
log.info('done')
def destroy(name):
"""destroy one cpuset by name as cset or string"""
log.debug('entering destroy, name=%s', name)
if isinstance(name, str):
set = cset.unique_set(name)
@ -261,7 +300,40 @@ def destroy(name):
# fixme: perhaps reparsing the all the sets is not so efficient...
cset.rescan()
def rename_set(options, args):
"""rename cpuset as specified in options and args lists"""
log.debug('entering rename_set, options=%s args=%s', options, args)
# figure out target cpuset name, if --set not used, use first arg
name = options.newname
if options.set:
tset = cset.unique_set(options.set)
elif len(args) > 0:
tset = cset.unique_set(args[0])
else:
raise CpusetException('desired cpuset not specified')
path = tset.path[0:tset.path.rfind('/')+1]
log.debug('target set="%s", path="%s", name="%s"', tset.path, path, name)
try:
if name.find('/') == -1:
chk = cset.unique_set(path+name)
else:
if name[0:name.rfind('/')+1] != path:
raise CpusetException('desired name cannot have different path')
chk = cset.unique_set(name)
raise CpusetException('cpuset "'+chk.path+'" already exists')
except CpusetNotFound:
pass
except:
raise
if name.rfind('/') != -1:
name = name[name.rfind('/')+1:]
log.info('--> renaming "%s" to "%s"', cset.CpuSet.basepath+tset.path, name)
os.rename(cset.CpuSet.basepath+tset.path, cset.CpuSet.basepath+path+name)
cset.rescan()
def create_from_options(options, args):
"""create cpuset as specified by options and args lists"""
log.debug('entering create_from_options, options=%s args=%s', options, args)
# figure out target cpuset name, if --set not used, use first arg
if options.set:
@ -292,6 +364,7 @@ def create_from_options(options, args):
active(tset)
def create(name, cpuspec, memspec, cx, mx):
"""create one cpuset by name, cpuspec, memspec, cpu and mem exclusive flags"""
log.debug('entering create, name=%s cpuspec=%s memspec=%s cx=%s mx=%s',
name, cpuspec, memspec, cx, mx)
try:
@ -310,6 +383,7 @@ def create(name, cpuspec, memspec, cx, mx):
modify(name, cpuspec, memspec, cx, mx)
def modify(name, cpuspec=None, memspec=None, cx=None, mx=None):
"""modify one cpuset by name, cpuspec, memspec, cpu and mem exclusive flags"""
log.debug('entering modify, name=%s cpuspec=%s memspec=%s cx=%s mx=%s',
name, cpuspec, memspec, cx, mx)
if isinstance(name, str):
@ -326,6 +400,7 @@ def modify(name, cpuspec=None, memspec=None, cx=None, mx=None):
if mx: nset.mem_exclusive = mx
def active(name):
"""check that cpuset by name or cset is ready to be used"""
log.debug("entering active, name=%s", name)
if isinstance(name, str):
set = cset.unique_set(name)
@ -339,55 +414,66 @@ def active(name):
raise CpusetException('"%s" cpuset not active, no mems defined' % set.path)
def set_header(indent=None):
"""return list of cpuset output header"""
if indent: istr = indent
else: istr = ''
l = []
# '1234567890-1234567890-1234567890-1234567890-1234567890'
# '123456789-123456789-123456789-123456789-123456789-123456789-'
l.append(istr + ' Name CPUs-X MEMs-X Tasks Subs Path')
l.append(istr + '------------ ---------- - ------- - ----- ---- ----------')
return l
def set_details(name, indent=None, width=75):
def set_details(name, indent=None, width=None, usehex=False):
"""return string of cpuset details"""
if width == None: width = 0
if isinstance(name, str):
set = cset.unique_set(name)
elif not isinstance(name, cset.CpuSet):
raise CpusetException("passing bogus set=%s" % name)
else:
set = name
if indent: istr = indent
else: istr = ''
l = []
used = 0
l.append(istr)
used += len(istr)
l.append(set.name.rjust(12))
used += 12
cs = set.cpus
if cs == '': cs = '*****'
l.append(cs.rjust(11))
used += 11
elif usehex: cs = cset.cpuspec_to_hex(cs)
l.append(cs.rjust(10))
if set.cpu_exclusive:
l.append(' y')
l.append('y')
else:
l.append(' n')
used += 2
l.append('n')
cs = set.mems
if cs == '': cs = '*****'
l.append(cs.rjust(8))
used += 8
elif usehex: cs = cset.cpuspec_to_hex(cs)
l.append(cs.rjust(7))
if set.mem_exclusive:
l.append(' y')
l.append('y')
else:
l.append(' n')
used += 2
l.append(str(len(set.tasks)).rjust(6))
used += 6
l.append(str(len(set.subsets)).rjust(5))
used += 5
l.append(' ')
used += 1
if width == 0:
l.append('n')
l.append(str(len(set.tasks)).rjust(5))
l.append(str(len(set.subsets)).rjust(4))
if config.mread:
l.append(set.path)
l2 = []
for line in l:
l2.append(line.strip())
return ';'.join(l2)
out = ' '.join(l) + ' '
tst = out + set.path
if width != 0 and len(tst) > width:
target = width - len(out)
patha = set.path[:len(set.path)/2-3]
pathb = set.path[len(set.path)/2:]
patha = patha[:target/2-3]
pathb = pathb[-target/2:]
out += patha + '...' + pathb
else:
l.append(set.path[:(width-used)])
return ''.join(l)
out = tst
if indent: istr = indent
else: istr = ''
return istr + out

@ -2,7 +2,7 @@
"""
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
@ -27,6 +27,7 @@ from cpuset.commands import proc
from cpuset.commands import set
from cpuset import cset
from cpuset.util import *
from cpuset import config
global log
log = logging.getLogger('shield')
@ -103,16 +104,16 @@ shielded cpuset with the --exec subcommand, or move processes or
threads already running to the shielded cpuset with the --shield
subcommand.
The PIDSPEC argument taken for the --shield (or -s) subcommand 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.
The PIDSPEC argument taken for the --pid (or -p) option (used in
conjunction with a --shield or --unshield command) 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.
For example:
1,2,5 Means processes 1, 2 and 5
1,2,600-700 Means processes 1, 2 and from 600 to 700
# cset shield --shield=50-65
# cset shield --shield --pid=50-65
This command moves all processes and threads with PID or
TID in the range 50-65 inclusive, from any cpuset they may
be running in into the shielded user cpuset.
@ -122,24 +123,18 @@ 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.
DANGER: Please note that there is no checking of processes you
request to move into the shield with the --shield command. This
means that the tool will happily move, for example, kernel
threads that are bound to specific CPUs with this command. You
can hang your system by indiscriminately specifying arbitrary
PIDs to the --shield command so please be careful.
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 option also takes a
PIDSPEC argument, the same as for the --shield subcommand.
the unshielded (or system) cpuset. This option is use with a
--pid and a PIDSPEC argument, the same as for the --shield
subcommand.
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 to these commands, then
just that status is output. 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.
shield if you do not specify a PIDSPEC with -p. 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.
Using no subcommand, ie. only "cset shield", will output the
status of both shield and non-shield. Tasks will be listed if
@ -179,25 +174,6 @@ USR_SET = '/user'
SYS_SET = '/system'
verbose = 0
# callback for --shield/--unshield, allows optional argument
# if no arg, then status of either shield or unshield is displayed
def shield_cb(option, opt_str, value, parser):
if value == None:
try:
arg = parser.rargs[0]
if arg[0] != '-':
# assign and consume argument
value = arg
del parser.rargs[0]
else:
value = True
except IndexError, err:
# no further arguments
value = True
except:
raise
setattr(parser.values, option.dest, value)
options = [make_option('-c', '--cpu',
metavar = 'CPUSPEC',
help = 'modifies or initializes the shield cpusets'),
@ -208,22 +184,24 @@ options = [make_option('-c', '--cpu',
help = 'executes args in the shield',
dest = 'exc',
action = 'store_true'),
make_option('--user',
make_option('--user',
help = 'use this USER for --exec (id or name)'),
make_option('--group',
make_option('--group',
help = 'use this GROUP for --exec (id or name)'),
make_option('-s', '--shield',
action = 'callback',
callback=shield_cb,
dest = 'shield',
metavar = 'PIDSPEC',
help = 'shield specified PIDSPEC of processes or threads'),
help = 'shield specified PIDSPEC of processes or threads',
action = 'store_true'),
make_option('-u', '--unshield',
action = 'callback',
callback=shield_cb,
dest = 'unshield',
help = 'remove specified PIDSPEC of processes or threads from shield',
action = 'store_true'),
make_option('-p', '--pid',
metavar = 'PIDSPEC',
help = 'remove specified PIDSPEC of processes or threads from shield'),
help = 'specify pid or tid specification for shield/unshield'),
make_option("--threads",
help = 'if specified, any processes found in the PIDSPEC to have '
'multiple threads will automatically have all their threads '
'added to the PIDSPEC; use to affect all related threads',
action = 'store_true'),
make_option('-k', '--kthread',
metavar = 'on|off',
choices = ['on', 'off'],
@ -256,61 +234,76 @@ def func(parser, options, args):
if (not options.cpu and not options.reset and not options.exc and
not options.shield and not options.unshield and not options.kthread):
shield_exists()
doshield = False
if len(args) == 0:
log.info("--> shielding system active with")
print_all_stats()
else:
exec_args(args, options.user, options.group)
return
# shortcut: first assume that arg is a pidspec, if not, then exec it
try:
plist = proc.pidspec_to_list(args[0])
for pid in plist: int(pid)
doshield = True
# ok, if we're here, then it's probably a pidspec, shield it
except:
exec_args(args, options.user, options.group)
if doshield:
# drop through to shield section below
options.pid = args[0]
options.shield = True
else:
return
if options.reset:
reset_shield()
return
# note that the following options fall through to others
# to allow for multiple options/commands on one cmdline
if options.cpu: make_shield(options.cpu, options.kthread)
if options.cpu:
make_shield(options.cpu, options.kthread)
return
elif options.kthread: make_kthread(options.kthread)
if options.kthread:
make_kthread(options.kthread)
return
if options.exc: exec_args(args, options.user, options.group)
if options.exc:
exec_args(args, options.user, options.group)
# exec_args does not return...
if options.shield:
if options.shield or options.unshield:
shield_exists()
try:
log.info('--> shielding following pidspec: %s', options.shield)
if options.force:
proc.move_pidspec(options.shield, USR_SET)
else:
proc.move_pidspec(options.shield, USR_SET, SYS_SET)
log.info('done')
except Exception, err:
if str(err).find('Permission denied') != -1:
raise
if options.shield != True:
log.info(err)
log.info('--> bad pidspec: %s, shield state is:', options.shield)
if options.shield:
smsg = 'shielding'
to_set = USR_SET
from_set = SYS_SET
print_stats = print_usr_stats
else:
smsg = 'unshielding'
to_set = SYS_SET
from_set = USR_SET
print_stats = print_sys_stats
if options.pid == None:
if len(args) > 0:
# shortcut, assumes arg[0] is a pidspec
options.pid = args[0]
else:
log.info('--> shielded state is:')
print_usr_stats()
if options.unshield:
shield_exists()
try:
log.info('--> unshielding following pidspec: %s', options.unshield)
# no pidspec so output shield state
print_stats()
if options.pid:
if options.threads: tmsg = '(with threads)'
else: tmsg = ''
log.info('--> %s following pidspec: %s %s', smsg, options.pid, tmsg)
if options.force:
proc.move_pidspec(options.unshield, SYS_SET)
proc.move_pidspec(options.pid, to_set, None, options.threads)
else:
proc.move_pidspec(options.unshield, SYS_SET, USR_SET)
log.info('done')
except Exception, err:
if str(err).find('Permission denied') != -1:
raise
if options.unshield != True:
log.info('--> bad pidspec: %s, unshielded state is:', options.unshield)
else:
log.info('--> not shielded state is:')
print_sys_stats()
try:
proc.move_pidspec(options.pid, to_set, from_set, options.threads)
except CpusetException, err:
if str(err).find('do not match all criteria') != -1:
log.info("--> hint: perhaps use --force if sure of command")
raise
log.info('done')
return
def print_all_stats():
print_sys_stats()
@ -323,7 +316,12 @@ def print_sys_stats():
else:
proc.log_detailed_task_table(cset.unique_set(SYS_SET), ' ')
else:
log.info(cset.summary(cset.unique_set(SYS_SET)))
if config.mread:
str = SYS_SET
if str[0] == '/': str = str[1:]
log.info('proc_list_no_tasks-' + str)
else:
log.info(cset.summary(cset.unique_set(SYS_SET)))
def print_usr_stats():
if verbose and len(cset.unique_set(USR_SET).tasks) > 0:
@ -332,7 +330,12 @@ def print_usr_stats():
else:
proc.log_detailed_task_table(cset.unique_set(USR_SET), ' ')
else:
log.info(cset.summary(cset.unique_set(USR_SET)))
if config.mread:
str = USR_SET
if str[0] == '/': str = str[1:]
log.info('proc_list_no_tasks-' + str)
else:
log.info(cset.summary(cset.unique_set(USR_SET)))
def shield_exists():
try:
@ -340,8 +343,8 @@ def shield_exists():
cset.unique_set(SYS_SET)
return True
except CpusetNotFound:
log.info('can\'t find "%s" and "%s" cpusets on system...', SYS_SET, USR_SET)
raise CpusetException('--> shielding not active on system')
log.debug('can\'t find "%s" and "%s" cpusets on system...', SYS_SET, USR_SET)
raise CpusetException('shielding not active on system')
def reset_shield():
log.info("--> deactivating/reseting shielding")
@ -349,11 +352,11 @@ def reset_shield():
tasks = cset.unique_set(USR_SET).tasks
log.info('moving %s tasks from "%s" user set to root set...',
len(tasks), USR_SET)
proc.move(USR_SET, 'root')
proc.move(USR_SET, 'root', None, verbose)
tasks = cset.unique_set(SYS_SET).tasks
log.info('moving %s tasks from "%s" system set to root set...',
len(tasks), SYS_SET)
proc.move(SYS_SET, 'root')
proc.move(SYS_SET, 'root', None, verbose)
log.info('deleting "%s" and "%s" sets', USR_SET, SYS_SET)
set.destroy(USR_SET)
set.destroy(SYS_SET)
@ -407,7 +410,7 @@ def make_shield(cpuspec, kthread):
pass
if len(tasks) != 0:
log.info("moving %s tasks from root into system cpuset...", len(tasks))
proc.move('root', SYS_SET, tasks)
proc.move('root', SYS_SET, tasks, verbose)
# move kernel theads into system set if asked for
if kthread == 'on':
root_tasks = cset.unique_set('/').tasks
@ -420,7 +423,7 @@ def make_shield(cpuspec, kthread):
if len(tasks) != 0:
log.info("kthread shield activated, moving %s tasks into system cpuset...",
len(tasks))
proc.move('root', SYS_SET, tasks)
proc.move('root', SYS_SET, tasks, verbose)
# print out stats
print_all_stats()
@ -442,11 +445,7 @@ def make_kthread(state):
log.debug("total root tasks %s", len(root_tasks))
log.info("kthread shield activated, moving %s tasks into system cpuset...",
len(tasks))
proc.move('root', SYS_SET, tasks)
if verbose == 1:
proc.log_detailed_task_table(tasks, ' ', 76)
elif verbose > 1:
proc.log_detailed_task_table(tasks, ' ')
proc.move('root', SYS_SET, tasks, verbose)
else:
log.info('--> deactivating kthread shielding')
usr_tasks = cset.unique_set(SYS_SET).tasks
@ -458,11 +457,7 @@ def make_kthread(state):
tasks.append(task)
if len(tasks) != 0:
log.info("moving %s tasks into root cpuset...", len(tasks))
proc.move(SYS_SET, '/', tasks)
if verbose == 1:
proc.log_detailed_task_table(tasks, ' ', 76)
elif verbose > 1:
proc.log_detailed_task_table(tasks, ' ')
proc.move(SYS_SET, '/', tasks, verbose)
log.info('done')
def exec_args(args, upar, gpar):

@ -0,0 +1,76 @@
""" Cpuset Configuration Module
The config module maintains global (class) variables of the various
configuration parameters for the cpuset application. These are filled in from
applicable configuration file passed as a path to the ReadConfigFile() method,
if desired. The class variables are given default values in the module source.
Anything found in the configuration files in the list of paths will override
these defaults.
"""
__copyright__ = """
Copyright (C) 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
import sys
import types
import ConfigParser
############################################################################
# Default configuration variable values
############################################################################
defloc = '/etc/cset.conf' # default config file location
mread = False # machine readable output, usually set
# via option -m/--machine
mountpoint = '/cpusets' # cpuset filessytem mount point
############################################################################
def ReadConfigFiles(path=None):
if path == None: path = defloc
cf = ConfigParser.ConfigParser()
try:
fr = cf.read(path)
if len(fr) == 0: return
# can't use logging, too early...
if len(cf.sections()) != 1:
print "cset: warning, more than one section found in config file:", cf.sections()
if 'default' not in cf.sections():
print 'cset: [default] section not found in config file "%s"' % path
sys.exit(3)
except ConfigParser.MissingSectionHeaderError:
f = open(path)
cstr = f.read()
f.close()
import StringIO
cf.readfp(StringIO.StringIO('[default]\n' + cstr))
# override our globals...
for opt in cf.options('default'):
typ = type(globals()[opt])
if typ == types.BooleanType:
globals()[opt] = cf.getboolean('default', opt)
elif typ == types.IntType:
globals()[opt] = cf.getint('default', opt)
else:
globals()[opt] = cf.get('default', opt)
# Importing module autoinitializes it
def __init():
ReadConfigFiles()
__init()

@ -2,7 +2,7 @@
"""
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
@ -26,8 +26,8 @@ if __name__ == '__main__':
logging.basicConfig()
from cpuset.util import *
global log
log = logging.getLogger('cset')
RootSet = None
class CpuSet(object):
# sets is a class variable dict that keeps track of all
@ -135,14 +135,14 @@ class CpuSet(object):
if not path:
# mounted cpusets not found, so mount them
# FIXME: provide default mount directory from config file
if not os.access("/cpusets", os.F_OK):
os.mkdir("/cpusets")
ret = os.system("mount -t cpuset none /cpusets")
if not os.access(config.mountpoint, os.F_OK):
os.mkdir(config.mountpoint)
ret = os.system("mount -t cpuset none " + config.mountpoint)
if ret:
raise CpusetException(
'mount of cpuset filesystem failed, do you have permission?')
path = "/cpusets"
path = config.mountpoint
log.debug("cpusets mounted at: " + path)
return path
@ -231,9 +231,10 @@ class CpuSet(object):
f.write(task)
f.close()
except Exception, err:
if str(err).find('Permission denied') != -1:
if str(err).find('No such process') != -1:
log.info('**> task %s not found, not moved', task)
else:
raise
# if here, means process is already gone, racy stuff...
if prog:
tick += 1
pb(tick)
@ -245,9 +246,41 @@ class CpuSet(object):
# Helper functions
#
def lookup_task_from_proc(pid):
"""lookup the cpuset of the specified pid from proc filesystem"""
log.debug("entering lookup_task_from_proc, pid = %s", str(pid))
path = "/proc/"+str(pid)+"/cpuset"
if os.access(path, os.F_OK):
set = file(path).readline()[:-1]
log.debug('lookup_task_from_proc: found task %s cpuset: %s', str(pid), set)
return set
# FIXME: add search for threads here...
raise CpusetException("task ID %s not found, i.e. not running" % str(pid))
def lookup_task_from_cpusets(pid):
"""lookup the cpuset of the specified pid from cpuset filesystem"""
log.debug("entering lookup_task_from_cpusets, pid = %s", str(pid))
global RootSet
if RootSet == None: rescan()
gotit = None
if pid in RootSet.tasks:
gotit = RootSet
else:
for node in walk_set(RootSet):
if pid in node.tasks:
gotit = node
break
if gotit:
log.debug('lookup_task_from_cpusets: found task %s cpuset: %s', str(pid),
gotit.path)
return gotit.path
raise CpusetException("task ID %s not found, i.e. not running" % str(pid))
def unique_set(name):
"""find a unique cpuset by name or path, raise if multiple sets found"""
log.debug("entering unique_set, name=%s", name)
if name == None:
raise CpusetException('unique_set() passed None as arg')
if isinstance(name, CpuSet): return name
nl = find_sets(name)
if len(nl) > 1:
@ -256,7 +289,7 @@ def unique_set(name):
return nl[0]
def find_sets(name):
"""find cpusets by name or path, return None if not found"""
"""find cpusets by name or path, raise CpusetNotFound if not found"""
log = logging.getLogger("cset.find_sets")
log.debug('finding "%s" in cpusets', name)
nodelist = []
@ -267,13 +300,15 @@ def find_sets(name):
log.debug("returning root set")
nodelist.append(RootSet)
else:
log.debug("walking from: %s", RootSet.name)
log.debug("walking from: %s", RootSet.path)
for node in walk_set(RootSet):
if node.name == name:
log.debug('... found node "%s"', name)
nodelist.append(node)
else:
log.debug("find by path")
# make sure that leading slash is used if searching by path
if name[0] != '/': name = '/' + name
if name in CpuSet.sets:
log.debug('... found node "%s"', CpuSet.sets[name].name)
nodelist.append(CpuSet.sets[name])
@ -294,30 +329,65 @@ def walk_set(set):
yield result
def rescan():
""" re-read the cpuset directory to sync system with data structs """
"""re-read the cpuset directory to sync system with data structs"""
log.debug("entering rescan")
global RootSet, maxcpu, allcpumask
RootSet = CpuSet()
# figure out system properties
maxcpu = int(RootSet.cpus[-1])
allcpumask = calc_cpumask(maxcpu)
def cpuspec_check(cpuspec):
""" check format of cpuspec for validity """
log.debug("cpuspec_check(%s), maxcpu=%s", cpuspec, maxcpu)
groups = cpuspec.split(',')
if int(groups[-1].split('-')[-1]) > int(maxcpu):
str = 'CPUSPEC "%s" specifies higher max(%s) than available(%s)' % \
(cpuspec, groups[-1].split('-')[-1], maxcpu)
log.debug(str)
raise CpusetException(str)
def cpuspec_check(cpuspec, usemax=True):
"""check format of cpuspec for validity"""
log.debug("cpuspec_check(%s)", cpuspec)
mo = re.search("[^0-9,\-]", cpuspec)
if mo:
str = 'CPUSPEC "%s" contains invalid charaters: %s' % (cpuspec, mo.group())
log.debug(str)
raise CpusetException(str)
groups = cpuspec.split(',')
if usemax and int(groups[-1].split('-')[-1]) > int(maxcpu):
str = 'CPUSPEC "%s" specifies higher max(%s) than available(%s)' % \
(cpuspec, groups[-1].split('-')[-1], maxcpu)
log.debug(str)
raise CpusetException(str)
for sub in groups:
it = sub.split('-')
if len(it) == 2:
if len(it[0]) == 0 or len(it[1]) == 0:
# catches negative numbers
raise CpusetException('CPUSPEC "%s" has bad group "%s"' % (cpuspec, sub))
if len(it) > 2:
raise CpusetException('CPUSPEC "%s" has bad group "%s"' % (cpuspec, sub))
def cpuspec_to_hex(cpuspec):
"""convert a cpuspec to the hexadecimal string representation"""
log.debug('cpuspec_to_string(%s)', cpuspec)
cpuspec_check(cpuspec, usemax=False)
groups = cpuspec.split(',')
number = 0
for sub in groups:
items = sub.split('-')
if len(items) == 1:
if not len(items[0]):
# two consecutive commas in cpuspec
continue
# one cpu in this group
log.debug(" adding cpu %s to result", items[0])
number |= 1 << int(items[0])
elif len(items) == 2:
il = [int(ii) for ii in items]
if il[1] >= il[0]: rng = range(il[0], il[1]+1)
else: rng = range(il[1], il[0]+1)
log.debug(' group=%s has cpu range of %s', sub, rng)
for num in rng: number |= 1 << num
else:
raise CpusetException('CPUSPEC "%s" has bad group "%s"' % (cpuspec, sub))
log.debug(' final int number=%s in hex=%x', number, number)
return '%x' % number
def memspec_check(memspec):
"""check format of memspec for validity """
"""check format of memspec for validity"""
# FIXME: look under /sys/devices/system/node for numa memory node
# information and check the memspec that way, currently we only do
# a basic check
@ -329,7 +399,7 @@ def memspec_check(memspec):
raise CpusetException(str)
def cpuspec_inverse(cpuspec):
""" calculate inverse of cpu specification """
"""calculate inverse of cpu specification"""
cpus = [0 for x in range(maxcpu+1)]
groups = cpuspec.split(',')
log.debug("cpuspec_inverse(%s) maxcpu=%d groups=%d",
@ -382,8 +452,10 @@ def cpuspec_inverse(cpuspec):
def summary(set):
"""return summary of cpuset with number of tasks running"""
log.debug("entering summary, set=%s", set.path)
return ('"%s" cpuset of: %+10s cpu, with: %+5s tasks running' %
(set.name, set.cpus, len(set.tasks)) )
if len(set.tasks) == 1: msg = 'task'
else: msg = 'tasks'
return ('"%s" cpuset of CPUSPEC(%s) with %s %s running' %
(set.name, set.cpus, len(set.tasks), msg) )
def calc_cpumask(max):
all = 1

@ -2,7 +2,7 @@
"""
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import sys, os
from optparse import OptionParser
from cpuset import config
import cpuset.commands
from cpuset.commands.common import CmdException
from cpuset.util import CpusetException
@ -73,7 +74,12 @@ def _print_helpstring(cmd):
print ' ' + cmd + ' ' * (12 - len(cmd)) + commands[cmd].help
def print_help():
print 'Usage: %s <command> [options]' % os.path.basename(sys.argv[0])
print 'Usage: %s [global options] <command> [command options]' % os.path.basename(sys.argv[0])
print
print 'Global options:'
print ' -l/--log <fname> output debugging log in fname'
print ' -m/--machine print machine readable output'
print ' -x/--tohex <CPUSPEC> convert a CPUSPEC to hex'
print
print 'Generic commands:'
print ' help print the detailed command usage'
@ -94,6 +100,10 @@ def print_help():
def main():
# handle pipes better
import signal
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
global prog
prog = os.path.basename(sys.argv[0])
@ -117,67 +127,6 @@ def main():
log = logging.getLogger('')
log.setLevel(logging.DEBUG)
cmd = sys.argv[1]
if cmd in ['-l', '--log']:
# FIXME: very fragile
logfile = sys.argv[2]
#trace = logging.FileHandler('/var/log/cset.log', 'w')
trace = logging.FileHandler(logfile, 'a')
trace.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s %(name)-6s %(levelname)-8s %(message)s',
'%y%m%d-%H:%M:%S')
trace.setFormatter(formatter)
logging.getLogger('').addHandler(trace)
log.debug("---------- STARTING ----------")
from cpuset.version import version
log.debug('Cpuset (cset) %s' % version)
del(sys.argv[2])
del(sys.argv[1])
if len(sys.argv) > 1:
cmd = sys.argv[1]
else:
log.debug("no arguments to process, exit")
print >> sys.stderr, 'usage: %s <command>' % prog
print >> sys.stderr, \
' Try "%s --help" for a list of supported commands' % prog
sys.exit(1)
if cmd in ['-h', '--help']:
if len(sys.argv) >= 3:
cmd = commands.canonical_cmd(sys.argv[2])
sys.argv[2] = '--help'
else:
print_help()
sys.exit(0)
if cmd == 'help':
if len(sys.argv) == 3 and not sys.argv[2] in ['-h', '--help']:
cmd = commands.canonical_cmd(sys.argv[2])
if not cmd in commands:
log.error('help: "%s" command unknown' % cmd)
sys.exit(1)
sys.argv[0] += ' %s' % cmd
command = commands[cmd]
parser = OptionParser(usage = command.usage,
option_list = command.options)
from pydoc import pager
pager(parser.format_help())
else:
print_help()
sys.exit(0)
if cmd in ['-v', '--version', 'version']:
from cpuset.version import version
log.info('Cpuset (cset) %s' % version)
sys.exit(0)
if cmd in ['copyright']:
log.info(__copyright__)
sys.exit(0)
# re-build the command line arguments
cmd = commands.canonical_cmd(cmd)
sys.argv[0] += ' %s' % cmd
del(sys.argv[1])
log.debug('cmdline: ' + ' '.join(sys.argv))
try:
debug_level = int(os.environ['CSET_DEBUG_LEVEL'])
except KeyError:
@ -186,6 +135,88 @@ def main():
log.error('Invalid CSET_DEBUG_LEVEL environment variable')
sys.exit(1)
while True:
if len(sys.argv) == 1:
log.error('no arguments, nothing to do!')
sys.exit(2)
cmd = sys.argv[1]
if cmd in ['-l', '--log']:
if len(sys.argv) < 3:
log.critical('not enough arguments')
sys.exit(1)
# FIXME: very fragile
logfile = sys.argv[2]
#trace = logging.FileHandler('/var/log/cset.log', 'w')
trace = logging.FileHandler(logfile, 'a')
trace.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s %(name)-6s %(levelname)-8s %(message)s',
'%y%m%d-%H:%M:%S')
trace.setFormatter(formatter)
logging.getLogger('').addHandler(trace)
log.debug("---------- STARTING ----------")
from cpuset.version import version
log.debug('Cpuset (cset) %s' % version)
del(sys.argv[2])
del(sys.argv[1])
continue
if cmd in ['-h', '--help']:
if len(sys.argv) >= 3:
cmd = commands.canonical_cmd(sys.argv[2])
sys.argv[2] = '--help'
else:
print_help()
sys.exit(0)
if cmd == 'help':
if len(sys.argv) == 3 and not sys.argv[2] in ['-h', '--help']:
cmd = commands.canonical_cmd(sys.argv[2])
if not cmd in commands:
log.error('help: "%s" command unknown' % cmd)
sys.exit(1)
sys.argv[0] += ' %s' % cmd
command = commands[cmd]
parser = OptionParser(usage = command.usage,
option_list = command.options)
from pydoc import pager
pager(parser.format_help())
else:
print_help()
sys.exit(0)
if cmd in ['-v', '--version', 'version']:
from cpuset.version import version
log.info('Cpuset (cset) %s' % version)
sys.exit(0)
if cmd in ['-c', 'copyright', 'copying']:
log.info(__copyright__)
sys.exit(0)
if cmd in ['-m', '--machine']:
config.mread = True
del(sys.argv[1])
continue
if cmd in ['-x', '--tohex']:
if len(sys.argv) < 3:
log.critical('not enough arguments')
sys.exit(1)
cpuspec = sys.argv[2]
import cset
try:
print cset.cpuspec_to_hex(cpuspec)
except (ValueError, OSError, IOError, CpusetException, CmdException), err:
log.critical('**> ' + str(err))
if debug_level:
raise
else:
sys.exit(2)
sys.exit(0)
break
# re-build the command line arguments
cmd = commands.canonical_cmd(cmd)
sys.argv[0] += ' %s' % cmd
del(sys.argv[1])
log.debug('cmdline: ' + ' '.join(sys.argv))
try:
# importing the cset class creates the model
log.debug("creating cpuset model")
@ -193,11 +224,10 @@ def main():
command = commands[cmd]
usage = command.usage.split('\n')[0].strip()
parser = OptionParser(usage = usage, option_list = command.options)
parser.disable_interspersed_args()
options, args = parser.parse_args()
command.func(parser, options, args)
except (ValueError, OSError, IOError, CpusetException, CmdException), err:
log.critical('%s: %s' % (cmd, err))
log.critical('**> ' + str(err))
if str(err).find('Permission denied') != -1:
log.critical('insufficient permissions, you probably need to be root')
if str(err).find('invalid literal') != -1:

@ -2,7 +2,7 @@
"""
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
import sys, time
from cpuset import config
class CpusetException(Exception):
pass
@ -45,7 +46,8 @@ class TwirlyBar:
self.__bar = ('|', '/', '-', '\\')
def tick(self):
print '\b' + self.__bar[self.__state] + '\b',
if not config.mread:
print '\b' + self.__bar[self.__state] + '\b',
self.__state = self.__state + 1
if self.__state > 3: self.__state = 0
@ -65,6 +67,8 @@ class ProgressBar:
self.block=chr(178)
else:
self.block=progresschar
if config.mread:
return
self.f=sys.stdout
if not self.finalcount: return
self.f.write('[')
@ -82,11 +86,12 @@ class ProgressBar:
percentcomplete=100
blockcount=int(percentcomplete/2)
if blockcount > self.blockcount:
for i in range(self.blockcount,blockcount):
self.f.write(self.block)
self.f.flush()
if not config.mread:
if blockcount > self.blockcount:
for i in range(self.blockcount,blockcount):
self.f.write(self.block)
self.f.flush()
if percentcomplete == 100: self.f.write("]\n")
if percentcomplete == 100: self.f.write("]\n")
self.blockcount=blockcount

@ -1,5 +1,5 @@
__copyright__ = """
Copyright (C) 2008 Novell Inc.
Copyright (C) 2008, 2009 Novell Inc.
Author: Alex Tsariounov <alext@novell.com>
This program is free software; you can redistribute it and/or modify
@ -16,4 +16,4 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
version = '1.04'
version = '1.5.0'

@ -48,8 +48,8 @@ install: man
-include doc.dep
clean:
#rm -f *.xml *.html *.pdf *.1 *.7 doc.dep
rm -f *.xml *.pdf doc.dep
#rm -f *.xml *.html *.pdf *.1 *.7 doc.dep
%.html : %.txt
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
@ -63,8 +63,8 @@ clean:
%.pdf: %.xml
xmlto pdf $<
# special formatting rules
#special formatting rules
tutorial.html : %.html : %.txt
$(ASCIIDOC) -b xhtml11 -d article -f tutorial.conf $(ASCIIDOC_EXTRA) $<
$(ASCIIDOC) -b xhtml11 -d article -f tutorial.conf -a toc -a numbered -a toclevels=4 $(ASCIIDOC_EXTRA) $<
tutorial.xml : %.xml : %.txt
$(ASCIIDOC) -b docbook -d article -f tutorial.conf $<

@ -47,7 +47,7 @@ endif::backend-docbook[]
ifdef::backend-xhtml11[]
[csetlink-inlinemacro]
<a href="cset-{target}.html">cset-{target}(1)</a>
<a href="cset-{target}.html">cset {target}(1)</a>
endif::backend-xhtml11[]
# csetdesc

@ -2,7 +2,7 @@
.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
.\" Instead of manually editing it, you probably should edit the DocBook XML
.\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
.TH "CSET\-PROC" "1" "05/30/2008" "" ""
.TH "CSET\-PROC" "1" "02/07/2009" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
@ -47,6 +47,9 @@ move specified tasks to specified cpuset; to move a PIDSPEC to a cpuset, use \-m
\-p PIDSPEC, \-\-pid=PIDSPEC
specify pid or tid specification
.TP
\-\-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)
.TP
\-s CPUSET, \-\-set=CPUSET
specify name of immediate cpuset
.TP
@ -59,7 +62,7 @@ specify name of origination cpuset
\-k, \-\-kthread
move, or include moving, unbound kernel threads
.TP
\-a, \-\-all
\-\-force
force all processes and threads to be moved
.TP
\-v, \-\-verbose
@ -71,9 +74,9 @@ To list which tasks are running in a particular cpuset, use the \-\-list command
For example:
\fB# cset proc \-\-list \-\-set priset\fR
\fB# cset proc \-\-list \-\-set myset\fR
This command will list all the tasks running in the cpuset called "priset".
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.
@ -83,6 +86,14 @@ For example:
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\(cqs options from your command\(cqs options.
For example:
\fB# cset proc \-\-set myset \-\-exec \(em ls \-l\fR
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:
@ -109,7 +120,7 @@ The move command accepts multiple common calling methods. For example, the follo
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 necesary since the tasks will be moved to the destination cpuset no matter which cpuset they are currently running on.
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.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
@ -118,6 +129,8 @@ Specifying the \-\-fromset is not necesary since the tasks will be moved to the
\fBNote\fR
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.
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:
@ -131,14 +144,14 @@ This command specifies that all processes and threads running on cpuset "comp1"
.nr an-break-flag 1
.br
\fBNote\fR
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 \-a/\-\-all switch, then all tasks, kernel or not, bound or not, will be moved.
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.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
\fBCaution\fR
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.
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.
@ -157,17 +170,19 @@ Then, to move a process from myset in group1 to yourset in group2, you would hav
# cset proc \-\-move \-\-pid=50 \-\-fromset=/group1/myset \-\-toset=/group2/yourset
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 specifed by path (such as above), are done with respect to the root of the cpuset filesystem.
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.
.SH "LICENSE"
Cpuset is licensed under the GNU GPL V2 only.
.SH "COPYRIGHT"
Copyright (c) 2008 Novell Inc.
Copyright (c) 2008\-2009 Novell Inc.
.SH "AUTHOR"
Written by Alex Tsariounov <alext@novell.com>.
Some substrate code and ideas were taken from the excellent Stacked GIT (stgit) v0.13 (see http://gna.org/projects/stgit and http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
.SH "SEE ALSO"
\fBcset\fR(1), \fBcset\-set\fR(1), \fBcset\-shield\fR(1), \fBtaskset\fR(1), \fBchrt\fR(1)
cset(1), cset\-set(1), cset\-shield(1)
/usr/share/doc/packages/cpuset/html/tutorial.html
taskset(1), chrt(1)
/usr/src/linux/Documentation/cpusets.txt

@ -3,7 +3,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.1.0" />
<meta name="generator" content="AsciiDoc 8.3.3" />
<title>cset-proc(1)</title>
<style type="text/css">
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
@ -26,10 +27,12 @@ a:visited {
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
tt {
@ -44,13 +47,18 @@ h1, h2, h3, h4, h5, h6 {
line-height: 1.3;
}
h1 {
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
border-bottom: 2px solid silver;
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
div.sectionbody {
font-family: serif;
@ -66,6 +74,10 @@ p {
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
pre {
padding: 0;
margin: 0;
@ -118,6 +130,7 @@ div.content { /* Block element content. */
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
text-align: left;
@ -153,13 +166,25 @@ div.listingblock > div.content {
padding: 0.5em;
}
div.quoteblock > div.content {
div.quoteblock {
padding-left: 2.0em;
}
div.attribution {
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock {
padding-left: 2.0em;
}
div.verseblock > div.content {
white-space: pre;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
@ -182,10 +207,6 @@ div.exampleblock > div.content {
padding: 0.5em;
}
div.verseblock div.content {
white-space: pre;
}
div.imageblock div.content { padding-left: 0; }
div.imageblock img { border: 1px solid silver; }
span.image img { border-style: none; }
@ -197,18 +218,38 @@ dl {
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: italic;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0;
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.olist2 {
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
div.tableblock > table {
border: 3px solid #527bbd;
@ -220,19 +261,49 @@ thead {
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.hlist {
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
td.hlist1 {
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: italic;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hlist2 {
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
@media print {
div#footer-badges { display: none; }
@ -247,14 +318,40 @@ div#toctitle {
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2 {
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
/* Overrides for manpage documents */
h1 {
padding-top: 0.5em;
padding-bottom: 0.5em;
border-top: 2px solid silver;
border-bottom: 2px solid silver;
}
h2 {
border-style: none;
}
div.sectionbody {
margin-left: 5%;
}
include1::./stylesheets/xhtml11-manpage.css[]
@media print {
div#toc { display: none; }
}
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
@ -263,6 +360,7 @@ div.sidebar-content {
padding: 0.5em;
}
div.sidebar-title, div.image-title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
margin-top: 0.0em;
@ -275,8 +373,17 @@ div.listingblock div.content {
padding: 0.5em;
}
div.quoteblock-content {
padding-left: 2.0em;
div.quoteblock-attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock-content {
white-space: pre;
}
div.verseblock-attribution {
padding-top: 0.75em;
text-align: left;
}
div.exampleblock-content {
@ -287,7 +394,6 @@ div.exampleblock-content {
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }
</style>
<title>cset-proc(1)</title>
</head>
<body>
<div id="header">
@ -304,7 +410,7 @@ cset-proc(1) Manual Page
<h2>SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
<div class="content"><em>cset</em> [cset options] <em>proc</em> [proc options] [args]
<div class="verseblock-content"><em>cset</em> [cset options] <em>proc</em> [proc options] [args]
<em>cset</em> proc --help
<em>cset</em> proc
<em>cset</em> proc my_set my_other_set
@ -314,12 +420,14 @@ cset-proc(1) Manual Page
<em>cset</em> proc --move 2442,3000-3200 my_set
<em>cset</em> proc --move --pid=2442,3000-3200 --toset=my_set
<em>cset</em> proc --move --fromset=my_set_1 --toset=my_set_2
<em>cset</em> proc --move --pid=42 --fromset=/group1/myset --toset=/group2/yourset</div></div>
<em>cset</em> proc --move --pid=42 --fromset=/group1/myset --toset=/group2/yourset</div>
<div class="verseblock-attribution">
</div></div>
</div>
<h2>OPTIONS</h2>
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<dl>
<dt>
<div class="dlist"><dl>
<dt class="hdlist1">
-h, --help
</dt>
<dd>
@ -327,7 +435,7 @@ cset-proc(1) Manual Page
prints the list of options for this command
</p>
</dd>
<dt>
<dt class="hdlist1">
-l, --list
</dt>
<dd>
@ -335,7 +443,7 @@ cset-proc(1) Manual Page
list processes in the specified cpuset
</p>
</dd>
<dt>
<dt class="hdlist1">
-e, --exec
</dt>
<dd>
@ -343,7 +451,7 @@ cset-proc(1) Manual Page
execute arguments in the specified cpuset
</p>
</dd>
<dt>
<dt class="hdlist1">
-u USER, --user=USER
</dt>
<dd>
@ -351,7 +459,7 @@ cset-proc(1) Manual Page
use this USER to --exec (id or name)
</p>
</dd>
<dt>
<dt class="hdlist1">
-g GROUP, --group=GROUP
</dt>
<dd>
@ -359,7 +467,7 @@ cset-proc(1) Manual Page
use this GROUP to --exec (id or name)
</p>
</dd>
<dt>
<dt class="hdlist1">
-m, --move
</dt>
<dd>
@ -369,7 +477,7 @@ cset-proc(1) Manual Page
and --toset
</p>
</dd>
<dt>
<dt class="hdlist1">
-p PIDSPEC, --pid=PIDSPEC
</dt>
<dd>
@ -377,7 +485,17 @@ cset-proc(1) Manual Page
specify pid or tid specification
</p>
</dd>
<dt>
<dt class="hdlist1">
--threads
</dt>
<dd>
<p>
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)
</p>
</dd>
<dt class="hdlist1">
-s CPUSET, --set=CPUSET
</dt>
<dd>
@ -385,7 +503,7 @@ cset-proc(1) Manual Page
specify name of immediate cpuset
</p>
</dd>
<dt>
<dt class="hdlist1">
-t TOSET, --toset=TOSET
</dt>
<dd>
@ -393,7 +511,7 @@ cset-proc(1) Manual Page
specify name of destination cpuset
</p>
</dd>
<dt>
<dt class="hdlist1">
-f FROMSET, --fromset=FROMSET
</dt>
<dd>
@ -401,7 +519,7 @@ cset-proc(1) Manual Page
specify name of origination cpuset
</p>
</dd>
<dt>
<dt class="hdlist1">
-k, --kthread
</dt>
<dd>
@ -409,15 +527,15 @@ cset-proc(1) Manual Page
move, or include moving, unbound kernel threads
</p>
</dd>
<dt>
-a, --all
<dt class="hdlist1">
--force
</dt>
<dd>
<p>
force all processes and threads to be moved
</p>
</dd>
<dt>
<dt class="hdlist1">
-v, --verbose
</dt>
<dd>
@ -425,31 +543,36 @@ cset-proc(1) Manual Page
prints more detailed output, additive
</p>
</dd>
</dl>
</dl></div>
</div>
<h2>DESCRIPTION</h2>
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<p>This command is used to run and manage arbitrary processes on
<div class="paragraph"><p>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 &#8212; use the standard OS ^C or kill commands for that.</p>
<p>To list which tasks are running in a particular cpuset, use the --list
command.</p>
<p>For example:</p>
<p><strong><tt># cset proc --list --set priset</tt></strong></p>
<p>This command will list all the tasks running in the cpuset called
"priset".</p>
<p>Processes are created by specifying the path to the executable
and specifying the cpuset that the process is to be created in.</p>
<p>For example:</p>
<p><strong><tt># cset proc --set=blazing_cpuset --exec /usr/bin/fast_code</tt></strong></p>
<p>This command will execute the /usr/bin/fast_code program on the
"blazing_cpuset" cpuset.</p>
<p>The PIDSPEC argument taken for the move command is a comma
"destroy" option&#8201;&#8212;&#8201;use the standard OS ^C or kill commands for that.</p></div>
<div class="paragraph"><p>To list which tasks are running in a particular cpuset, use the --list
command.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="paragraph"><p><strong><tt># cset proc --list --set myset</tt></strong></p></div>
<div class="paragraph"><p>This command will list all the tasks running in the cpuset called
"myset".</p></div>
<div class="paragraph"><p>Processes are created by specifying the path to the executable
and specifying the cpuset that the process is to be created in.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="paragraph"><p><strong><tt># cset proc --set=blazing_cpuset --exec /usr/bin/fast_code</tt></strong></p></div>
<div class="paragraph"><p>This command will execute the /usr/bin/fast_code program on the
"blazing_cpuset" cpuset.</p></div>
<div class="paragraph"><p>Note that if your command takes options, then use the traditional
"--" marker to separate cset&#8217;s options from your command&#8217;s options.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="paragraph"><p><strong><tt># cset proc --set myset --exec&#8201;&#8212;&#8201;ls -l</tt></strong></p></div>
<div class="paragraph"><p>This command will execute "ls -l" on the cpuset called "myset".</p></div>
<div class="paragraph"><p>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.</p>
<p>For example:</p>
endpoints.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>1,2,5 Means processes 1, 2 and 5
@ -466,20 +589,20 @@ there is only one process, say PID 57, in the range of 50-65,
then only that process will be moved.</td>
</tr></table>
</div>
<p>To move a PIDSPEC to a specific cpuset, you can either specify
<div class="paragraph"><p>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.</p>
<p>The move command accepts multiple common calling methods.
For example, the following commands are equivalent:</p>
<p><strong><tt># cset proc --move 2442,3000-3200 reserved_set</tt></strong></p>
<p><strong><tt># cset proc --move --pid=2442,3000-3200 --toset=reserved_set</tt></strong></p>
<p>These commands move the tasks defined as 2442 and any running task
for the --move arguments.</p></div>
<div class="paragraph"><p>The move command accepts multiple common calling methods.
For example, the following commands are equivalent:</p></div>
<div class="paragraph"><p><strong><tt># cset proc --move 2442,3000-3200 reserved_set</tt></strong></p></div>
<div class="paragraph"><p><strong><tt># cset proc --move --pid=2442,3000-3200 --toset=reserved_set</tt></strong></p></div>
<div class="paragraph"><p>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".</p>
<p>Specifying the --fromset is not necesary since the tasks will be
"reserved_set".</p></div>
<div class="paragraph"><p>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.</p>
currently running on.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -492,12 +615,17 @@ I.e., if there is a task running on the system but not in
--fromset that is in PIDSPEC, it will not be moved.</td>
</tr></table>
</div>
<p>To move all userspace tasks from one cpuset to another, you need
to specify the source and destination cpuset by name.</p>
<p>For example:</p>
<p><strong><tt># cset proc --move --fromset=comp1 --toset=comp42</tt></strong></p>
<p>This command specifies that all processes and threads
running on cpuset "comp1" be moved to cpuset "comp42".</p>
<div class="paragraph"><p>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.</p></div>
<div class="paragraph"><p>To move all userspace tasks from one cpuset to another, you need
to specify the source and destination cpuset by name.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="paragraph"><p><strong><tt># cset proc --move --fromset=comp1 --toset=comp42</tt></strong></p></div>
<div class="paragraph"><p>This command specifies that all processes and threads
running on cpuset "comp1" be moved to cpuset "comp42".</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -507,7 +635,7 @@ running on cpuset "comp1" be moved to cpuset "comp42".</p>
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 <strong>also specify</strong> the
-a/--all switch, then all tasks, kernel or not, bound or not,
--force switch, then all tasks, kernel or not, bound or not,
will be moved.</td>
</tr></table>
</div>
@ -516,18 +644,18 @@ will be moved.</td>
<td class="icon">
<div class="title">Caution</div>
</td>
<td class="content">Please be cautious with the --all switch, since moving a
kernel thread that is bound to a specific CPU to a cpuset that
<td class="content">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.</td>
</tr></table>
</div>
<p>You must specify unique cpuset names for the both exec and move
<div class="paragraph"><p>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.</p>
<p>For example, suppose you have the following cpuset tree:</p>
rooted at the base cpuset tree.</p></div>
<div class="paragraph"><p>For example, suppose you have the following cpuset tree:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>/cpusets
@ -538,39 +666,37 @@ rooted at the base cpuset tree.</p>
/myset
/yourset</tt></pre>
</div></div>
<p>Then, to move a process from myset in group1 to yourset in
group2, you would have to issue the following command:</p>
<p><tt># cset proc --move --pid=50 --fromset=/group1/myset --toset=/group2/yourset</tt></p>
<p>You do not have to worry about where in the Linux filesystem the
<div class="paragraph"><p>Then, to move a process from myset in group1 to yourset in
group2, you would have to issue the following command:</p></div>
<div class="paragraph"><p><tt># cset proc --move --pid=50 --fromset=/group1/myset --toset=/group2/yourset</tt></p></div>
<div class="paragraph"><p>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 specifed by path (such as above), are done with
respect to the root of the cpuset filesystem.</p>
Any cpusets that are specified by path (such as above), are done with
respect to the root of the cpuset filesystem.</p></div>
</div>
<h2>LICENSE</h2>
<h2 id="_license">LICENSE</h2>
<div class="sectionbody">
<p>Cpuset is licensed under the GNU GPL V2 only.</p>
<div class="paragraph"><p>Cpuset is licensed under the GNU GPL V2 only.</p></div>
</div>
<h2>COPYRIGHT</h2>
<h2 id="_copyright">COPYRIGHT</h2>
<div class="sectionbody">
<p>Copyright (c) 2008 Novell Inc.</p>
<div class="paragraph"><p>Copyright (c) 2008-2009 Novell Inc.</p></div>
</div>
<h2>AUTHOR</h2>
<h2 id="_author">AUTHOR</h2>
<div class="sectionbody">
<p>Written by Alex Tsariounov &lt;alext@novell.com&gt;.</p>
<p>Some substrate code and ideas were taken from the excellent Stacked
GIT (stgit) v0.13 (see http://gna.org/projects/stgit and
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.</p>
<div class="paragraph"><p>Written by Alex Tsariounov &lt;alext@novell.com&gt;.</p></div>
</div>
<h2>SEE ALSO</h2>
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<p><a href="cset.html">cset(1)</a>, <a href="cset-set.html">cset-set(1)</a>, <a href="cset-shield.html">cset-shield(1)</a>, <a href="taskset.html">taskset(1)</a>,
<a href="chrt.html">chrt(1)</a></p>
<p>/usr/src/linux/Documentation/cpusets.txt</p>
<div class="paragraph"><p>cset(1), cset-set(1), cset-shield(1)</p></div>
<div class="paragraph"><p>/usr/share/doc/packages/cpuset/html/tutorial.html</p></div>
<div class="paragraph"><p>taskset(1), chrt(1)</p></div>
<div class="paragraph"><p>/usr/src/linux/Documentation/cpusets.txt</p></div>
</div>
<div id="footer">
<div id="footer-text">
Version 1.0<br />
Last updated 30-May-2008 14:33:23 MDT
Version 1.5.0<br />
Last updated 2009-02-07 18:55:55 MDT
</div>
</div>
</body>

@ -1,7 +1,7 @@
cset-proc(1)
============
Alex Tsariounov <alext@novell.com>
v1.0, May 2008
v1.5.0, February 2009
NAME
----
@ -47,6 +47,11 @@ OPTIONS
-p PIDSPEC, --pid=PIDSPEC::
specify pid or tid specification
--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
@ -59,7 +64,7 @@ OPTIONS
-k, --kthread::
move, or include moving, unbound kernel threads
-a, --all::
--force::
force all processes and threads to be moved
-v, --verbose::
@ -77,10 +82,10 @@ command.
For example:
*+# cset proc --list --set priset+*
*+# cset proc --list --set myset+*
This command will list all the tasks running in the cpuset called
"priset".
"myset".
Processes are created by specifying the path to the executable
and specifying the cpuset that the process is to be created in.
@ -92,6 +97,15 @@ For example:
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
@ -123,7 +137,7 @@ 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 necesary since the tasks will be
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.
@ -133,6 +147,12 @@ 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.
@ -147,11 +167,11 @@ NOTE: 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 *also specify* the
-a/--all switch, then all tasks, kernel or not, bound or not,
--force switch, then all tasks, kernel or not, bound or not,
will be moved.
CAUTION: Please be cautious with the --all switch, since moving a
kernel thread that is bound to a specific CPU to a cpuset that
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
@ -178,7 +198,7 @@ group2, you would have to issue the following command:
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 specifed by path (such as above), are done with
Any cpusets that are specified by path (such as above), are done with
respect to the root of the cpuset filesystem.
LICENSE
@ -187,19 +207,18 @@ Cpuset is licensed under the GNU GPL V2 only.
COPYRIGHT
---------
Copyright (c) 2008 Novell Inc.
Copyright (c) 2008-2009 Novell Inc.
AUTHOR
------
Written by Alex Tsariounov <alext@novell.com>.
Some substrate code and ideas were taken from the excellent Stacked
GIT (stgit) v0.13 (see http://gna.org/projects/stgit and
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
Written by Alex Tsariounov <\alext@novell.com>.
SEE ALSO
--------
manlink:cset[1], csetlink:set[], csetlink:shield[], manlink:taskset[1],
manlink:chrt[1]
cset(1), cset-set(1), cset-shield(1)
/usr/share/doc/packages/cpuset/html/tutorial.html
taskset(1), chrt(1)
/usr/src/linux/Documentation/cpusets.txt

@ -2,7 +2,7 @@
.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
.\" Instead of manually editing it, you probably should edit the DocBook XML
.\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
.TH "CSET\-SET" "1" "05/30/2008" "" ""
.TH "CSET\-SET" "1" "02/07/2009" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
@ -15,11 +15,9 @@ cset\-set \- manage sets of cpus
\fIcset\fR [cset options] \fIset\fR [set options] [args]
\fIcset\fR set \-\-help
\fIcset\fR set
\fIcset\fR set \-\-all
\fIcset\fR set \-\-recurse
\fIcset\fR set \-\-list myset
\fIcset\fR set myset
\fIcset\fR set \-\-all myset
\fIcset\fR set \-\-recurse \-\-list myset
\fIcset\fR set \-\-cpu 2\-5 \-\-mem 0 \-\-set newset
\fIcset\fR set \-\-cpu 2\-5 newset
@ -47,9 +45,6 @@ destroy specified cpuset
\-s CPUSET, \-\-set=CPUSET
specify cpuset name to be acted on
.TP
\-a, \-\-all
also do listing of members of specified cpuset, for use with \-\-list
.TP
\-r, \-\-recurse
do recursive listing, for use with \-\-list
.TP
@ -64,7 +59,7 @@ mark this cpuset as owning its MEMs exclusively
.SH "DESCRIPTION"
This command is used to create, modify, and destroy cpusets. Cpusets form a tree\-like structure rooted at the root cpuset which always includes all system CPUs and all system memory nodes.
A cpuset is an organizational unit that defines a group of CPUs and a group of memory nodes where a process or thread (i.e. task) is allowed to run on. For non\-NUMA machines, the memory node is always 0 (zero) and cannot be set to anything else. For NUMA machines, the memory node can be set to a similar specifcation as the CPU definition and will tie those memory nodes to that cpuset. You will usually want the memory nodes that belong to the CPUs defined to be in the same cpuset.
A cpuset is an organizational unit that defines a group of CPUs and a group of memory nodes where a process or thread (i.e. task) is allowed to run on. For non\-NUMA machines, the memory node is always 0 (zero) and cannot be set to anything else. For NUMA machines, the memory node can be set to a similar specification as the CPU definition and will tie those memory nodes to that cpuset. You will usually want the memory nodes that belong to the CPUs defined to be in the same cpuset.
A cpuset can have exclusive right to the CPUs defined in it. This means that only this cpuset can own these CPUs. Similarly, a cpuset can have exclusive right to the memory nodes defined in it. This means that only this cpuset can own these memory nodes.
@ -91,19 +86,21 @@ This command creates a cpuset called "new_set" located off the root cpuset which
Create a cpuset that specifies both CPUs and memory nodes
\fB# cset set \-\-cpu=3 \-\-mem=3 /rad/set_one\fR
Note that this command uses the full path method to specify the name of the new cpuset "/rad/set_one". It also names the new cpuset implicitily (i.e. no \-\-set option, although you can use that if you want to). If the "set_one" name is unique, you can subsequently refer to is just by that. Memory node 3 is assigned to this cpuset as well as CPU 3.
Note that this command uses the full path method to specify the name of the new cpuset "/rad/set_one". It also names the new cpuset implicitly (i.e. no \-\-set option, although you can use that if you want to). If the "set_one" name is unique, you can subsequently refer to is just by that. Memory node 3 is assigned to this cpuset as well as CPU 3.
The above commands will create the new cpusets, or if they already exist, they will modify them to the new specifications.
.SH "LICENSE"
Cpuset is licensed under the GNU GPL V2 only.
.SH "COPYRIGHT"
Copyright (c) 2008 Novell Inc.
Copyright (c) 2008\-2009 Novell Inc.
.SH "AUTHOR"
Written by Alex Tsariounov <alext@novell.com>.
Some substrate code and ideas were taken from the excellent Stacked GIT (stgit) v0.13 (see http://gna.org/projects/stgit and http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
.SH "SEE ALSO"
\fBcset\fR(1), \fBcset\-proc\fR(1), \fBcset\-shield\fR(1), \fBtaskset\fR(1), \fBchrt\fR(1)
cset(1), cset\-proc(1), cset\-shield(1)
/usr/share/doc/packages/cpuset/html/tutorial.html
taskset(1), chrt(1)
/usr/src/linux/Documentation/cpusets.txt

@ -3,7 +3,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.1.0" />
<meta name="generator" content="AsciiDoc 8.3.3" />
<title>cset-set(1)</title>
<style type="text/css">
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
@ -26,10 +27,12 @@ a:visited {
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
tt {
@ -44,13 +47,18 @@ h1, h2, h3, h4, h5, h6 {
line-height: 1.3;
}
h1 {
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
border-bottom: 2px solid silver;
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
div.sectionbody {
font-family: serif;
@ -66,6 +74,10 @@ p {
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
pre {
padding: 0;
margin: 0;
@ -118,6 +130,7 @@ div.content { /* Block element content. */
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
text-align: left;
@ -153,13 +166,25 @@ div.listingblock > div.content {
padding: 0.5em;
}
div.quoteblock > div.content {
div.quoteblock {
padding-left: 2.0em;
}
div.attribution {
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock {
padding-left: 2.0em;
}
div.verseblock > div.content {
white-space: pre;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
@ -182,10 +207,6 @@ div.exampleblock > div.content {
padding: 0.5em;
}
div.verseblock div.content {
white-space: pre;
}
div.imageblock div.content { padding-left: 0; }
div.imageblock img { border: 1px solid silver; }
span.image img { border-style: none; }
@ -197,18 +218,38 @@ dl {
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: italic;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0;
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.olist2 {
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
div.tableblock > table {
border: 3px solid #527bbd;
@ -220,19 +261,49 @@ thead {
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.hlist {
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
td.hlist1 {
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: italic;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hlist2 {
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
@media print {
div#footer-badges { display: none; }
@ -247,14 +318,40 @@ div#toctitle {
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2 {
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
/* Overrides for manpage documents */
h1 {
padding-top: 0.5em;
padding-bottom: 0.5em;
border-top: 2px solid silver;
border-bottom: 2px solid silver;
}
h2 {
border-style: none;
}
div.sectionbody {
margin-left: 5%;
}
include1::./stylesheets/xhtml11-manpage.css[]
@media print {
div#toc { display: none; }
}
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
@ -263,6 +360,7 @@ div.sidebar-content {
padding: 0.5em;
}
div.sidebar-title, div.image-title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
margin-top: 0.0em;
@ -275,8 +373,17 @@ div.listingblock div.content {
padding: 0.5em;
}
div.quoteblock-content {
padding-left: 2.0em;
div.quoteblock-attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock-content {
white-space: pre;
}
div.verseblock-attribution {
padding-top: 0.75em;
text-align: left;
}
div.exampleblock-content {
@ -287,7 +394,6 @@ div.exampleblock-content {
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }
</style>
<title>cset-set(1)</title>
</head>
<body>
<div id="header">
@ -304,25 +410,25 @@ cset-set(1) Manual Page
<h2>SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
<div class="content"><em>cset</em> [cset options] <em>set</em> [set options] [args]
<div class="verseblock-content"><em>cset</em> [cset options] <em>set</em> [set options] [args]
<em>cset</em> set --help
<em>cset</em> set
<em>cset</em> set --all
<em>cset</em> set --recurse
<em>cset</em> set --list myset
<em>cset</em> set myset
<em>cset</em> set --all myset
<em>cset</em> set --recurse --list myset
<em>cset</em> set --cpu 2-5 --mem 0 --set newset
<em>cset</em> set --cpu 2-5 newset
<em>cset</em> set --cpu 1,2,5-7 another_set
<em>cset</em> set --destroy newset
<em>cset</em> set --destroy /mygroup_sets/my_set</div></div>
<em>cset</em> set --destroy /mygroup_sets/my_set</div>
<div class="verseblock-attribution">
</div></div>
</div>
<h2>OPTIONS</h2>
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<dl>
<dt>
<div class="dlist"><dl>
<dt class="hdlist1">
-h, --help
</dt>
<dd>
@ -330,7 +436,7 @@ cset-set(1) Manual Page
prints the list of options for this command
</p>
</dd>
<dt>
<dt class="hdlist1">
-l, --list
</dt>
<dd>
@ -339,7 +445,7 @@ cset-set(1) Manual Page
cpuset; if -r is used, will list recursively
</p>
</dd>
<dt>
<dt class="hdlist1">
-c CPUSPEC, --cpu=CPUSPEC
</dt>
<dd>
@ -348,7 +454,7 @@ cset-set(1) Manual Page
specification
</p>
</dd>
<dt>
<dt class="hdlist1">
-m MEMSPEC, --mem=MEMSPEC
</dt>
<dd>
@ -357,7 +463,7 @@ cset-set(1) Manual Page
cpuset
</p>
</dd>
<dt>
<dt class="hdlist1">
-d, --destroy
</dt>
<dd>
@ -365,7 +471,7 @@ cset-set(1) Manual Page
destroy specified cpuset
</p>
</dd>
<dt>
<dt class="hdlist1">
-s CPUSET, --set=CPUSET
</dt>
<dd>
@ -373,15 +479,7 @@ cset-set(1) Manual Page
specify cpuset name to be acted on
</p>
</dd>
<dt>
-a, --all
</dt>
<dd>
<p>
also do listing of members of specified cpuset, for use with --list
</p>
</dd>
<dt>
<dt class="hdlist1">
-r, --recurse
</dt>
<dd>
@ -389,7 +487,7 @@ cset-set(1) Manual Page
do recursive listing, for use with --list
</p>
</dd>
<dt>
<dt class="hdlist1">
-v, --verbose
</dt>
<dd>
@ -398,7 +496,7 @@ cset-set(1) Manual Page
will not chop listing to fit in 80 columns
</p>
</dd>
<dt>
<dt class="hdlist1">
--cpu_exclusive
</dt>
<dd>
@ -406,7 +504,7 @@ cset-set(1) Manual Page
mark this cpuset as owning its CPUs exclusively
</p>
</dd>
<dt>
<dt class="hdlist1">
--mem_exclusive
</dt>
<dd>
@ -414,64 +512,64 @@ cset-set(1) Manual Page
mark this cpuset as owning its MEMs exclusively
</p>
</dd>
</dl>
</dl></div>
</div>
<h2>DESCRIPTION</h2>
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<p>This command is used to create, modify, and destroy cpusets.
<div class="paragraph"><p>This command is used to create, modify, and destroy cpusets.
Cpusets form a tree-like structure rooted at the root cpuset
which always includes all system CPUs and all system memory
nodes.</p>
<p>A cpuset is an organizational unit that defines a group of CPUs
nodes.</p></div>
<div class="paragraph"><p>A cpuset is an organizational unit that defines a group of CPUs
and a group of memory nodes where a process or thread (i.e. task)
is allowed to run on. For non-NUMA machines, the memory node is
always 0 (zero) and cannot be set to anything else. For NUMA
machines, the memory node can be set to a similar specifcation
machines, the memory node can be set to a similar specification
as the CPU definition and will tie those memory nodes to that
cpuset. You will usually want the memory nodes that belong to
the CPUs defined to be in the same cpuset.</p>
<p>A cpuset can have exclusive right to the CPUs defined in it.
the CPUs defined to be in the same cpuset.</p></div>
<div class="paragraph"><p>A cpuset can have exclusive right to the CPUs defined in it.
This means that only this cpuset can own these CPUs. Similarly,
a cpuset can have exclusive right to the memory nodes defined in
it. This means that only this cpuset can own these memory
nodes.</p>
<p>Cpusets can be specified by name or by path; however, care
nodes.</p></div>
<div class="paragraph"><p>Cpusets can be specified by name or by path; however, care
should be taken when specifying by name if the name is not
unique. This tool will generally not let you do destructive
things to non-unique cpuset names.</p>
<p>Cpusets are uniquely specified by path. The path starts at where
things to non-unique cpuset names.</p></div>
<div class="paragraph"><p>Cpusets are uniquely specified by path. The path starts at where
the cpusets filesystem is mounted so you generally do not have to
know where that is. For example, so specify a cpuset that is
called "two" which is a subset of "one" which in turn is a subset
of the root cpuset, use the path "/one/two" regardless of where
the cpusets filesystem is mounted.</p>
<p>When specifying CPUs, a so-called CPUSPEC is used. The CPUSPEC
the cpusets filesystem is mounted.</p></div>
<div class="paragraph"><p>When specifying CPUs, a so-called CPUSPEC is used. 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 specified cpuset.</p>
<p>Note that cpusets follow certain rules. For example, children
CPU3, CPU5, CPU6, and CPU7 to the specified cpuset.</p></div>
<div class="paragraph"><p>Note that cpusets follow certain rules. For example, children
can only include CPUs that the parents already have. If you do
not follow those rules, the kernel cpuset subsystem will not let
you create that cpuset. For example, if you create a cpuset that
contains CPU3, and then attempt to create a child of that cpuset
with a CPU other than 3, you will get an error, and the cpuset
will not be active. The error is somewhat cryptic in that it is
usually a "Permission denied" error.</p>
<p>Memory nodes are specified with a MEMSPEC in a similar way to
usually a "Permission denied" error.</p></div>
<div class="paragraph"><p>Memory nodes are specified with a MEMSPEC in a similar way to
the CPUSPEC. For example, --mem=1,3-6 will assign MEM1, MEM3,
MEM4, MEM5, and MEM6 to the specified cpuset.</p>
<p>Note that if you attempt to create or modify a cpuset with a
MEM4, MEM5, and MEM6 to the specified cpuset.</p></div>
<div class="paragraph"><p>Note that if you attempt to create or modify a cpuset with a
memory node specification that is not valid, you may get a
cryptic error message, "No space left on device", and the
modification will not be allowed.</p>
<p>When you destroy a cpuset, then the tasks running in that set are
modification will not be allowed.</p></div>
<div class="paragraph"><p>When you destroy a cpuset, then the tasks running in that set are
moved to the parent of that cpuset. If this is not what you
want, then manually move those tasks to the cpuset of your choice
with the <em>cset proc</em> command (see <em>cset proc --help</em> for more
information).</p>
<h3>EXAMPLES</h3>
<dl>
<dt>
information).</p></div>
<h3 id="_examples">EXAMPLES</h3><div style="clear:left"></div>
<div class="dlist"><dl>
<dt class="hdlist1">
Create a cpuset with the default memory specification
</dt>
<dd>
@ -479,14 +577,14 @@ Create a cpuset with the default memory specification
<strong><tt># cset set --cpu=2,4,6-8 --set=new_set</tt></strong>
</p>
</dd>
</dl>
<p>This command creates a cpuset called "new_set" located
</dl></div>
<div class="paragraph"><p>This command creates a cpuset called "new_set" located
off the root cpuset which holds CPUS 2,4,6,7,8 and node 0
(interleaved) memory. Note that --set is optional, and
you can just specify the name for the new cpuset after
all arguments.</p>
<dl>
<dt>
all arguments.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
Create a cpuset that specifies both CPUs and memory nodes
</dt>
<dd>
@ -494,42 +592,40 @@ Create a cpuset that specifies both CPUs and memory nodes
<strong><tt># cset set --cpu=3 --mem=3 /rad/set_one</tt></strong>
</p>
</dd>
</dl>
<p>Note that this command uses the full path method to
</dl></div>
<div class="paragraph"><p>Note that this command uses the full path method to
specify the name of the new cpuset "/rad/set_one". It
also names the new cpuset implicitily (i.e. no --set
also names the new cpuset implicitly (i.e. no --set
option, although you can use that if you want to). If
the "set_one" name is unique, you can subsequently refer
to is just by that. Memory node 3 is assigned to this
cpuset as well as CPU 3.</p>
<p>The above commands will create the new cpusets, or if they
already exist, they will modify them to the new specifications.</p>
cpuset as well as CPU 3.</p></div>
<div class="paragraph"><p>The above commands will create the new cpusets, or if they
already exist, they will modify them to the new specifications.</p></div>
</div>
<h2>LICENSE</h2>
<h2 id="_license">LICENSE</h2>
<div class="sectionbody">
<p>Cpuset is licensed under the GNU GPL V2 only.</p>
<div class="paragraph"><p>Cpuset is licensed under the GNU GPL V2 only.</p></div>
</div>
<h2>COPYRIGHT</h2>
<h2 id="_copyright">COPYRIGHT</h2>
<div class="sectionbody">
<p>Copyright (c) 2008 Novell Inc.</p>
<div class="paragraph"><p>Copyright (c) 2008-2009 Novell Inc.</p></div>
</div>
<h2>AUTHOR</h2>
<h2 id="_author">AUTHOR</h2>
<div class="sectionbody">
<p>Written by Alex Tsariounov &lt;alext@novell.com&gt;.</p>
<p>Some substrate code and ideas were taken from the excellent Stacked
GIT (stgit) v0.13 (see http://gna.org/projects/stgit and
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.</p>
<div class="paragraph"><p>Written by Alex Tsariounov &lt;alext@novell.com&gt;.</p></div>
</div>
<h2>SEE ALSO</h2>
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<p><a href="cset.html">cset(1)</a>, <a href="cset-proc.html">cset-proc(1)</a>, <a href="cset-shield.html">cset-shield(1)</a>, <a href="taskset.html">taskset(1)</a>,
<a href="chrt.html">chrt(1)</a></p>
<p>/usr/src/linux/Documentation/cpusets.txt</p>
<div class="paragraph"><p>cset(1), cset-proc(1), cset-shield(1)</p></div>
<div class="paragraph"><p>/usr/share/doc/packages/cpuset/html/tutorial.html</p></div>
<div class="paragraph"><p>taskset(1), chrt(1)</p></div>
<div class="paragraph"><p>/usr/src/linux/Documentation/cpusets.txt</p></div>
</div>
<div id="footer">
<div id="footer-text">
Version 1.0<br />
Last updated 30-May-2008 14:33:23 MDT
Version 1.5.0<br />
Last updated 2009-02-07 18:55:56 MDT
</div>
</div>
</body>

@ -1,7 +1,7 @@
cset-set(1)
===========
Alex Tsariounov <alext@novell.com>
v1.0, May 2008
v1.5.0, February 2009
NAME
----
@ -13,11 +13,9 @@ SYNOPSIS
'cset' [cset options] 'set' [set options] [args]
'cset' set --help
'cset' set
'cset' set --all
'cset' set --recurse
'cset' set --list myset
'cset' set myset
'cset' set --all myset
'cset' set --recurse --list myset
'cset' set --cpu 2-5 --mem 0 --set newset
'cset' set --cpu 2-5 newset
@ -48,9 +46,6 @@ OPTIONS
-s CPUSET, --set=CPUSET::
specify cpuset name to be acted on
-a, --all::
also do listing of members of specified cpuset, for use with --list
-r, --recurse::
do recursive listing, for use with --list
@ -75,7 +70,7 @@ A cpuset is an organizational unit that defines a group of CPUs
and a group of memory nodes where a process or thread (i.e. task)
is allowed to run on. For non-NUMA machines, the memory node is
always 0 (zero) and cannot be set to anything else. For NUMA
machines, the memory node can be set to a similar specifcation
machines, the memory node can be set to a similar specification
as the CPU definition and will tie those memory nodes to that
cpuset. You will usually want the memory nodes that belong to
the CPUs defined to be in the same cpuset.
@ -146,7 +141,7 @@ Create a cpuset that specifies both CPUs and memory nodes::
Note that this command uses the full path method to
specify the name of the new cpuset "/rad/set_one". It
also names the new cpuset implicitily (i.e. no --set
also names the new cpuset implicitly (i.e. no --set
option, although you can use that if you want to). If
the "set_one" name is unique, you can subsequently refer
to is just by that. Memory node 3 is assigned to this
@ -161,19 +156,18 @@ Cpuset is licensed under the GNU GPL V2 only.
COPYRIGHT
---------
Copyright (c) 2008 Novell Inc.
Copyright (c) 2008-2009 Novell Inc.
AUTHOR
------
Written by Alex Tsariounov <alext@novell.com>.
Some substrate code and ideas were taken from the excellent Stacked
GIT (stgit) v0.13 (see http://gna.org/projects/stgit and
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
Written by Alex Tsariounov <\alext@novell.com>.
SEE ALSO
--------
manlink:cset[1], csetlink:proc[], csetlink:shield[], manlink:taskset[1],
manlink:chrt[1]
cset(1), cset-proc(1), cset-shield(1)
/usr/share/doc/packages/cpuset/html/tutorial.html
taskset(1), chrt(1)
/usr/src/linux/Documentation/cpusets.txt

@ -2,7 +2,7 @@
.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
.\" Instead of manually editing it, you probably should edit the DocBook XML
.\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
.TH "CSET\-SHIELD" "1" "05/30/2008" "" ""
.TH "CSET\-SHIELD" "1" "02/07/2009" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
@ -19,8 +19,8 @@ cset\-shield \- cpuset supercommand which implements cpu shielding
\fIcset\fR shield \-\-cpu 1\-7 \-\-kthread=on
\fIcset\fR shield \-\-exec /opt/software/myapp/doit \-\-my_opt1 \-\-my_opt2
\fIcset\fR shield \-\-user appuser \-\-exec run_benchmark.sh
\fIcset\fR shield \-\-shield 1024,2048,5000\-1000
\fIcset\fR shield \-\-unshield 6000\-8500
\fIcset\fR shield \-\-shield \-\-pid 1024,2048,5000\-1000
\fIcset\fR shield \-\-unshield \-\-pid 6000\-8500
\fIcset\fR shield \-\-kthread=off
\fIcset\fR shield \-\-kthread=on
\fIcset\fR shield \-\-shield bash
@ -45,11 +45,14 @@ use this USER for \-\-exec (id or name)
\-\-group=GROUP
use this GROUP for \-\-exec (id or name)
.TP
\-s PIDSPEC, \-\-shield=PIDSPEC
shield specified PIDSPEC of processes or threads
\-s, \-\-shield
shield PIDSPEC specified with \-p/\-\-pid of processes or threads
.TP
\-u PIDSPEC, \-\-unshield=PIDSPEC
remove specified PIDSPEC of processes or threads from the shield, the task keep running in the unshielded cpuset
\-u, \-\-unshield
remove PIDSPEC specified with \-p/\-\-pid of processes or threads from the shield, the tasks keep running in the unshielded cpuset
.TP
\-\-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 shield or unshield all related threads)
.TP
\-k on|off, \-\-kthread=on|off
shield from unbound interrupt threads as well
@ -74,7 +77,7 @@ Usually, CPU zero would be in the system set and the rest of the CPUs would be i
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.
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.
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.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
@ -87,11 +90,11 @@ To create a shield, you would execute the shield command with the \-\-cpu option
For example:
\fB# cset shield \-\-cpu=3\fR
\fB# cset shield \-\-cpu=1\-3\fR
On a 4\-way machine, this command will dedicate the first 3 processors, CPU0\-CPU2, for the system set (unshielded) and only the last processor, CPU3, for the user set (shielded).
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).
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.
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.
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.
@ -108,9 +111,17 @@ The above command will use the name "free" for the unshielded system cpuset, the
\fBNote\fR
If you do use the \-\-syset/\-\-userset options, then you must continue to use those for every invocation of the shield supercommand.
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.
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.
The PIDSPEC argument taken for the \-\-shield (or \-s) subcommand 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.
Note that if your execed command takes options, then use the traditional "\-\-" marker to separate cset\(cqs options from your command\(cqs options.
For example:
\fB# cset shield \-\-exec \(em ls \-l\fR
This command will execute "ls \-l" inside the shield.
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.
For example:
.sp
@ -118,9 +129,9 @@ For example:
1,2,5 Means processes 1, 2 and 5
1,2,600\-700 Means processes 1, 2 and from 600 to 700
.fi
\fB# cset shield \-\-shield=50\-65\fR
\fB# cset shield \-\-shield \-\-pid=50\-65\fR
The above command moves all processes and threads with PID or TID in the range 50\-65 inclusive, from any cpuset they may be running in into the shielded user cpuset.
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.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
@ -128,17 +139,10 @@ The above command moves all processes and threads with PID or TID in the range 5
.br
\fBNote\fR
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.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
\fBCaution\fR
Please note that there is no checking of processes you request to move into the shield with the \-\-shield command. This means that the tool will happily move, for example, kernel threads that are bound to specific CPUs with this command. You can hang your system by indiscriminately specifying arbitrary PIDs to the \-\-shield command so please be careful.
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 option also takes a PIDSPEC argument, the same as for the \-\-shield subcommand.
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 conjuction with a \-p/\-\-pid option that specifies a PIDSPEC argument, the same as for the \-\-shield subcommand.
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 to these commands, then just that status is output. 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.
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.
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.
@ -161,13 +165,15 @@ Even though you can mix general usage of cpusets with the shielding concepts des
.SH "LICENSE"
Cpuset is licensed under the GNU GPL V2 only.
.SH "COPYRIGHT"
Copyright (c) 2008 Novell Inc.
Copyright (c) 2008\-2009 Novell Inc.
.SH "AUTHOR"
Written by Alex Tsariounov <alext@novell.com>.
Some substrate code and ideas were taken from the excellent Stacked GIT (stgit) v0.13 (see http://gna.org/projects/stgit and http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
.SH "SEE ALSO"
\fBcset\fR(1), \fBcset\-set\fR(1), \fBcset\-proc\fR(1), \fBtaskset\fR(1), \fBchrt\fR(1)
cset(1), cset\-set(1), cset\-proc(1)
/usr/share/doc/packages/cpuset/html/tutorial.html
taskset(1), chrt(1)
/usr/src/linux/Documentation/cpusets.txt

@ -3,7 +3,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.1.0" />
<meta name="generator" content="AsciiDoc 8.3.3" />
<title>cset-shield(1)</title>
<style type="text/css">
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
@ -26,10 +27,12 @@ a:visited {
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
tt {
@ -44,13 +47,18 @@ h1, h2, h3, h4, h5, h6 {
line-height: 1.3;
}
h1 {
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
border-bottom: 2px solid silver;
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
div.sectionbody {
font-family: serif;
@ -66,6 +74,10 @@ p {
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
pre {
padding: 0;
margin: 0;
@ -118,6 +130,7 @@ div.content { /* Block element content. */
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
text-align: left;
@ -153,13 +166,25 @@ div.listingblock > div.content {
padding: 0.5em;
}
div.quoteblock > div.content {
div.quoteblock {
padding-left: 2.0em;
}
div.attribution {
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock {
padding-left: 2.0em;
}
div.verseblock > div.content {
white-space: pre;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
@ -182,10 +207,6 @@ div.exampleblock > div.content {
padding: 0.5em;
}
div.verseblock div.content {
white-space: pre;
}
div.imageblock div.content { padding-left: 0; }
div.imageblock img { border: 1px solid silver; }
span.image img { border-style: none; }
@ -197,18 +218,38 @@ dl {
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: italic;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0;
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.olist2 {
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
div.tableblock > table {
border: 3px solid #527bbd;
@ -220,19 +261,49 @@ thead {
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.hlist {
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
td.hlist1 {
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: italic;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hlist2 {
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
@media print {
div#footer-badges { display: none; }
@ -247,14 +318,40 @@ div#toctitle {
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2 {
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
/* Overrides for manpage documents */
h1 {
padding-top: 0.5em;
padding-bottom: 0.5em;
border-top: 2px solid silver;
border-bottom: 2px solid silver;
}
h2 {
border-style: none;
}
div.sectionbody {
margin-left: 5%;
}
include1::./stylesheets/xhtml11-manpage.css[]
@media print {
div#toc { display: none; }
}
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
@ -263,6 +360,7 @@ div.sidebar-content {
padding: 0.5em;
}
div.sidebar-title, div.image-title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
margin-top: 0.0em;
@ -275,8 +373,17 @@ div.listingblock div.content {
padding: 0.5em;
}
div.quoteblock-content {
padding-left: 2.0em;
div.quoteblock-attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock-content {
white-space: pre;
}
div.verseblock-attribution {
padding-top: 0.75em;
text-align: left;
}
div.exampleblock-content {
@ -287,7 +394,6 @@ div.exampleblock-content {
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }
</style>
<title>cset-shield(1)</title>
</head>
<body>
<div id="header">
@ -304,23 +410,25 @@ cset-shield(1) Manual Page
<h2>SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
<div class="content"><em>cset</em> [cset options] <em>shield</em> [shield options] [args]
<div class="verseblock-content"><em>cset</em> [cset options] <em>shield</em> [shield options] [args]
<em>cset</em> shield --help
<em>cset</em> shield
<em>cset</em> shield --cpu 1-7
<em>cset</em> shield --cpu 1-7 --kthread=on
<em>cset</em> shield --exec /opt/software/myapp/doit --my_opt1 --my_opt2
<em>cset</em> shield --user appuser --exec run_benchmark.sh
<em>cset</em> shield --shield 1024,2048,5000-1000
<em>cset</em> shield --unshield 6000-8500
<em>cset</em> shield --shield --pid 1024,2048,5000-1000
<em>cset</em> shield --unshield --pid 6000-8500
<em>cset</em> shield --kthread=off
<em>cset</em> shield --kthread=on
<em>cset</em> shield --shield bash</div></div>
<em>cset</em> shield --shield bash</div>
<div class="verseblock-attribution">
</div></div>
</div>
<h2>OPTIONS</h2>
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<dl>
<dt>
<div class="dlist"><dl>
<dt class="hdlist1">
-h, --help
</dt>
<dd>
@ -328,7 +436,7 @@ cset-shield(1) Manual Page
prints the list of options for this command
</p>
</dd>
<dt>
<dt class="hdlist1">
-c CPUSPEC, --cpu=CPUSPEC
</dt>
<dd>
@ -336,7 +444,7 @@ cset-shield(1) Manual Page
modifies or initializes the shield cpusets
</p>
</dd>
<dt>
<dt class="hdlist1">
-r, --reset
</dt>
<dd>
@ -344,7 +452,7 @@ cset-shield(1) Manual Page
destroys the shield
</p>
</dd>
<dt>
<dt class="hdlist1">
-e, --exec
</dt>
<dd>
@ -352,7 +460,7 @@ cset-shield(1) Manual Page
executes args in the shield
</p>
</dd>
<dt>
<dt class="hdlist1">
--user=USER
</dt>
<dd>
@ -360,7 +468,7 @@ cset-shield(1) Manual Page
use this USER for --exec (id or name)
</p>
</dd>
<dt>
<dt class="hdlist1">
--group=GROUP
</dt>
<dd>
@ -368,24 +476,34 @@ cset-shield(1) Manual Page
use this GROUP for --exec (id or name)
</p>
</dd>
<dt>
-s PIDSPEC, --shield=PIDSPEC
<dt class="hdlist1">
-s, --shield
</dt>
<dd>
<p>
shield specified PIDSPEC of processes or threads
shield PIDSPEC specified with -p/--pid of processes or threads
</p>
</dd>
<dt>
-u PIDSPEC, --unshield=PIDSPEC
<dt class="hdlist1">
-u, --unshield
</dt>
<dd>
<p>
remove specified PIDSPEC of processes or threads from the shield,
the task keep running in the unshielded cpuset
remove PIDSPEC specified with -p/--pid of processes or threads from
the shield, the tasks keep running in the unshielded cpuset
</p>
</dd>
<dt>
<dt class="hdlist1">
--threads
</dt>
<dd>
<p>
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)
</p>
</dd>
<dt class="hdlist1">
-k on|off, --kthread=on|off
</dt>
<dd>
@ -393,7 +511,7 @@ cset-shield(1) Manual Page
shield from unbound interrupt threads as well
</p>
</dd>
<dt>
<dt class="hdlist1">
-f, --force
</dt>
<dd>
@ -401,7 +519,7 @@ cset-shield(1) Manual Page
force operation, use with care
</p>
</dd>
<dt>
<dt class="hdlist1">
-v, --verbose
</dt>
<dd>
@ -409,7 +527,7 @@ cset-shield(1) Manual Page
prints more detailed output, additive
</p>
</dd>
<dt>
<dt class="hdlist1">
--sysset=SYSSET
</dt>
<dd>
@ -417,7 +535,7 @@ cset-shield(1) Manual Page
optionally specify system cpuset name
</p>
</dd>
<dt>
<dt class="hdlist1">
--userset=USERSET
</dt>
<dd>
@ -425,32 +543,32 @@ cset-shield(1) Manual Page
optionally specify user cpuset name
</p>
</dd>
</dl>
</dl></div>
</div>
<h2>DESCRIPTION</h2>
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<p>This is a supercommand that creates basic cpu shielding. The
<div class="paragraph"><p>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.</p>
<p>The concept of shielding implies at minimum three cpusets, for
create and manage a common type of cpu shielding setup.</p></div>
<div class="paragraph"><p>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.</p>
<p>Usually, CPU zero would be in the system set and the rest of the
of interest.</p></div>
<div class="paragraph"><p>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.</p>
<p>If the optional --kthread=on option is given to the shield
processes will also run the system cpuset.</p></div>
<div class="paragraph"><p>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.</p>
<p>One executes processes on the shielded user cpuset with the
bound interrupt kernel threads) are also moved to the system set.</p></div>
<div class="paragraph"><p>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.</p>
cpuset with the --shield subcommand with a --pid option.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -460,32 +578,32 @@ cpuset with the --shield subcommand.</p>
is running in initially when using the --shield subcommand.</td>
</tr></table>
</div>
<p>To create a shield, you would execute the shield command with the
<div class="paragraph"><p>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).</p>
<p>For example:</p>
<p><strong><tt># cset shield --cpu=3</tt></strong></p>
<p>On a 4-way machine, this command will dedicate the first
3 processors, CPU0-CPU2, for the system set (unshielded)
and only the last processor, CPU3, for the user set
(shielded).</p>
<p>The CPUSPEC will accept a comma separated list of CPUs and
other cpus will be assigned to the system set).</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="paragraph"><p><strong><tt># cset shield --cpu=1-3</tt></strong></p></div>
<div class="paragraph"><p>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).</p></div>
<div class="paragraph"><p>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.</p>
<p>If you do not like the names "system" and "user" for the
cpuset and the inverse of that to the system (or unshielded)
cpuset.</p></div>
<div class="paragraph"><p>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.</p>
<p>For example:</p>
<p><strong><tt># cset shield --sysset=free --userset=cage --cpu=2,3 --kthread=on</tt></strong></p>
<p>The above command will use the name "free" for the unshielded
used already, then use the --sysset and --userset options.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="paragraph"><p><strong><tt># cset shield --sysset=free --userset=cage --cpu=2,3 --kthread=on</tt></strong></p></div>
<div class="paragraph"><p>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.</p>
cpuset.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -495,24 +613,31 @@ cpuset.</p>
continue to use those for every invocation of the shield supercommand.</td>
</tr></table>
</div>
<p>After initialization, you can run the process of interest on the
<div class="paragraph"><p>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.</p>
<p>The PIDSPEC argument taken for the --shield (or -s) subcommand 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.</p>
<p>For example:</p>
subcommand and the --pid option.</p></div>
<div class="paragraph"><p>Note that if your execed command takes options, then use the
traditional "--" marker to separate cset&#8217;s options from your
command&#8217;s options.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="paragraph"><p><strong><tt># cset shield --exec&#8201;&#8212;&#8201;ls -l</tt></strong></p></div>
<div class="paragraph"><p>This command will execute "ls -l" inside the shield.</p></div>
<div class="paragraph"><p>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.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>1,2,5 Means processes 1, 2 and 5
1,2,600-700 Means processes 1, 2 and from 600 to 700</tt></pre>
</div></div>
<p><strong><tt># cset shield --shield=50-65</tt></strong></p>
<p>The above command moves all processes and threads with PID or
TID in the range 50-65 inclusive, from any cpuset they may
be running in into the shielded user cpuset.</p>
<div class="paragraph"><p><strong><tt># cset shield --shield --pid=50-65</tt></strong></p></div>
<div class="paragraph"><p>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.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -524,51 +649,39 @@ there is only one process, say PID 57, in the range of 50-65,
then only that process will be moved.</td>
</tr></table>
</div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
<div class="title">Caution</div>
</td>
<td class="content">Please note that there is no checking of processes you
request to move into the shield with the --shield command. This
means that the tool will happily move, for example, kernel
threads that are bound to specific CPUs with this command. You
can hang your system by indiscriminately specifying arbitrary
PIDs to the --shield command so please be careful.</td>
</tr></table>
</div>
<p>The --unshield (or -u) subcommand will remove the specified
<div class="paragraph"><p>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 option also takes a
PIDSPEC argument, the same as for the --shield subcommand.</p>
<p>Both the --shield and the --unshield commands will also finally
the unshielded (or system) cpuset. This command is also used in
conjuction with a -p/--pid option that specifies a PIDSPEC
argument, the same as for the --shield subcommand.</p></div>
<div class="paragraph"><p>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 to these commands, then
just that status is output. 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.</p>
<p>Using no subcommand, ie. only "cset shield", will output 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.</p></div>
<div class="paragraph"><p>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.</p>
<p>You can adjust which CPUs are in the shielded cpuset by issuing
--verbose is used.</p></div>
<div class="paragraph"><p>You can adjust which CPUs are in the shielded cpuset by issuing
the --cpu subcommand again anytime after the shield has been
initialized.</p>
<p>For example if the original shield contained CPU0 and CPU1 in the
initialized.</p></div>
<div class="paragraph"><p>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:</p>
<p><strong><tt># cset shield --cpu=1,2,3</tt></strong></p>
<p>then that command will move CPU1 into the shielded "user" cpuset.
the following command:</p></div>
<div class="paragraph"><p><strong><tt># cset shield --cpu=1,2,3</tt></strong></p></div>
<div class="paragraph"><p>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.</p>
<p>The --reset subcommand will in essence destroy the shield. For
system.</p></div>
<div class="paragraph"><p>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.</p>
be destroyed.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -582,31 +695,29 @@ and proc) directly.</td>
</tr></table>
</div>
</div>
<h2>LICENSE</h2>
<h2 id="_license">LICENSE</h2>
<div class="sectionbody">
<p>Cpuset is licensed under the GNU GPL V2 only.</p>
<div class="paragraph"><p>Cpuset is licensed under the GNU GPL V2 only.</p></div>
</div>
<h2>COPYRIGHT</h2>
<h2 id="_copyright">COPYRIGHT</h2>
<div class="sectionbody">
<p>Copyright (c) 2008 Novell Inc.</p>
<div class="paragraph"><p>Copyright (c) 2008-2009 Novell Inc.</p></div>
</div>
<h2>AUTHOR</h2>
<h2 id="_author">AUTHOR</h2>
<div class="sectionbody">
<p>Written by Alex Tsariounov &lt;alext@novell.com&gt;.</p>
<p>Some substrate code and ideas were taken from the excellent Stacked
GIT (stgit) v0.13 (see http://gna.org/projects/stgit and
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.</p>
<div class="paragraph"><p>Written by Alex Tsariounov &lt;alext@novell.com&gt;.</p></div>
</div>
<h2>SEE ALSO</h2>
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<p><a href="cset.html">cset(1)</a>, <a href="cset-set.html">cset-set(1)</a>, <a href="cset-proc.html">cset-proc(1)</a>, <a href="taskset.html">taskset(1)</a>,
<a href="chrt.html">chrt(1)</a></p>
<p>/usr/src/linux/Documentation/cpusets.txt</p>
<div class="paragraph"><p>cset(1), cset-set(1), cset-proc(1)</p></div>
<div class="paragraph"><p>/usr/share/doc/packages/cpuset/html/tutorial.html</p></div>
<div class="paragraph"><p>taskset(1), chrt(1)</p></div>
<div class="paragraph"><p>/usr/src/linux/Documentation/cpusets.txt</p></div>
</div>
<div id="footer">
<div id="footer-text">
Version 1.0<br />
Last updated 30-May-2008 14:33:24 MDT
Version 1.5.0<br />
Last updated 2009-02-07 18:55:57 MDT
</div>
</div>
</body>

@ -1,7 +1,7 @@
cset-shield(1)
==============
Alex Tsariounov <alext@novell.com>
v1.0, May 2008
v1.5.0, February 2009
NAME
----
@ -17,8 +17,8 @@ SYNOPSIS
'cset' shield --cpu 1-7 --kthread=on
'cset' shield --exec /opt/software/myapp/doit --my_opt1 --my_opt2
'cset' shield --user appuser --exec run_benchmark.sh
'cset' shield --shield 1024,2048,5000-1000
'cset' shield --unshield 6000-8500
'cset' shield --shield --pid 1024,2048,5000-1000
'cset' shield --unshield --pid 6000-8500
'cset' shield --kthread=off
'cset' shield --kthread=on
'cset' shield --shield bash
@ -43,12 +43,17 @@ OPTIONS
--group=GROUP::
use this GROUP for --exec (id or name)
-s PIDSPEC, --shield=PIDSPEC::
shield specified PIDSPEC of processes or threads
-s, --shield::
shield PIDSPEC specified with -p/--pid of processes or threads
-u PIDSPEC, --unshield=PIDSPEC::
remove specified PIDSPEC of processes or threads from the shield,
the task keep running in the unshielded cpuset
-u, --unshield::
remove PIDSPEC specified with -p/--pid of processes or threads from
the shield, the tasks keep running in the unshielded cpuset
--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 shield or unshield all related threads)
-k on|off, --kthread=on|off::
shield from unbound interrupt threads as well
@ -92,7 +97,7 @@ bound interrupt kernel threads) are also moved to the system set.
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.
cpuset with the --shield subcommand with a --pid option.
NOTE: You do not need to specify which cpuset a process or thread
is running in initially when using the --shield subcommand.
@ -104,16 +109,16 @@ other cpus will be assigned to the system set).
For example:
*+# cset shield --cpu=3+*
*+# cset shield --cpu=1-3+*
On a 4-way machine, this command will dedicate the first
3 processors, CPU0-CPU2, for the system set (unshielded)
and only the last processor, CPU3, for the user set
(shielded).
processor, CPU0, for the system set (unshielded) and the last
three processors, CPU1, CPU2, CPU3, for the user set (shielded).
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.
If you do not like the names "system" and "user" for the
@ -138,47 +143,52 @@ continue to use those for every invocation of the shield supercommand.
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.
subcommand and the --pid option.
Note that if your execed command takes options, then use the
traditional "--" marker to separate cset's options from your
command's options.
For example:
*+# cset shield --exec -- ls -l+*
The PIDSPEC argument taken for the --shield (or -s) subcommand 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.
This command will execute "ls -l" inside the shield.
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.
For example:
1,2,5 Means processes 1, 2 and 5
1,2,600-700 Means processes 1, 2 and from 600 to 700
*+# cset shield --shield=50-65+*
*+# cset shield --shield --pid=50-65+*
The above command moves all processes and threads with PID or
TID in the range 50-65 inclusive, from any cpuset they may
be running in into the shielded user cpuset.
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.
NOTE: 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.
CAUTION: Please note that there is no checking of processes you
request to move into the shield with the --shield command. This
means that the tool will happily move, for example, kernel
threads that are bound to specific CPUs with this command. You
can hang your system by indiscriminately specifying arbitrary
PIDs to the --shield command so please be careful.
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 option also takes a
PIDSPEC argument, the same as for the --shield subcommand.
the unshielded (or system) cpuset. This command is also used in
conjuction with a -p/--pid option that specifies a PIDSPEC
argument, the same as for the --shield subcommand.
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 to these commands, then
just that status is output. 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.
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.
Using no subcommand, ie. only "cset shield", will output the
status of both shield and non-shield. Tasks will be listed if
@ -220,19 +230,18 @@ Cpuset is licensed under the GNU GPL V2 only.
COPYRIGHT
---------
Copyright (c) 2008 Novell Inc.
Copyright (c) 2008-2009 Novell Inc.
AUTHOR
------
Written by Alex Tsariounov <alext@novell.com>.
Some substrate code and ideas were taken from the excellent Stacked
GIT (stgit) v0.13 (see http://gna.org/projects/stgit and
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
Written by Alex Tsariounov <\alext@novell.com>.
SEE ALSO
--------
manlink:cset[1], csetlink:set[], csetlink:proc[], manlink:taskset[1],
manlink:chrt[1]
cset(1), cset-set(1), cset-proc(1)
/usr/share/doc/packages/cpuset/html/tutorial.html
taskset(1), chrt(1)
/usr/src/linux/Documentation/cpusets.txt

@ -2,7 +2,7 @@
.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
.\" Instead of manually editing it, you probably should edit the DocBook XML
.\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
.TH "CSET" "1" "05/30/2008" "" ""
.TH "CSET" "1" "02/07/2009" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
@ -12,7 +12,7 @@ cset \- manage cpusets functions in the Linux kernel
.SH "SYNOPSIS"
.sp
.nf
\fIcset\fR [\-\-version | \-\-help | \-\-log]
\fIcset\fR [\-\-version | \-\-help | \-\-tohex]
\fIcset\fR [help <command> | <command> \-\-help]
\fIcset\fR [cset options] <command> [command options] [args]
.fi
@ -31,60 +31,69 @@ Cpuset is a Python application to make using the cpusets facilities in the Linux
Setting up and managing a simple shielded CPU environment
The concept of \fIshielded\fR cpus is that a certain number of cpus are partitioned off on the system and only processes that are of interest are run on these cpus (i.e., inside the shield).
For a simple shielded configuration, one typically uses three cpusets: the root set, a system set and a user set. \fICset\fR includes a super command that implements this strategy and lets you easily manage it. See \fBcset\-shield\fR(1) for more details.
For a simple shielded configuration, one typically uses three cpusets: the root set, a system set and a user set. \fICset\fR includes a super command that implements this strategy and lets you easily manage it. See \fIcset\-shield(1)\fR for more details.
.TP
Setting up and managing a comples shielding environment
Shielding can be more complex of course where concepts such as priority cpusets and intersecting cpuset can be used. You can use \fIcset\fR to help manage this type of shielding as well. You will need to use the \fBcset\-set\fR(1) and \fBcset\-proc\fR(1) subcommands directly to do that.
Shielding can be more complex of course where concepts such as priority cpusets and intersecting cpuset can be used. You can use \fIcset\fR to help manage this type of shielding as well. You will need to use the \fIcset\-set(1)\fR and \fIcset\-proc(1)\fR subcommands directly to do that.
.TP
Managing cpusets on the system
The cset subcommand \fBcset\-set\fR(1) allows you to create and destroy arbitrary cpusets on the system and assign arbitrary cpus and memory nodes to them. The cpusets so created have to follow the Linux kernel cpuset rules. See the \fBcset\-set\fR(1) subcommand for more details.
The cset subcommand \fIcset\-set(1)\fR allows you to create and destroy arbitrary cpusets on the system and assign arbitrary cpus and memory nodes to them. The cpusets so created have to follow the Linux kernel cpuset rules. See the \fIcset\-set(1)\fR subcommand for more details.
.TP
Managing processes that run on various system cpusets
The cset subcommand \fBcset\-proc\fR(1) allows you to manage processes running on various cpusets created on the system. You can exec new processes in specific cpusets and move tasks around existing cpusets. See the \fBcset\-proc\fR(1) subcommand for more details.
The cset subcommand \fIcset\-proc(1)\fR allows you to manage processes running on various cpusets created on the system. You can exec new processes in specific cpusets and move tasks around existing cpusets. See the \fIcset\-proc(1)\fR subcommand for more details.
.SH "OPTIONS"
The following generic option flags are available. Additional options are available per\-command, and documented in the command\-specific documentation.
.TP
\fIcset\fR \-\-version
Prints the cpuset suite version that the \fIcset\fR program came from, as well as version of other components used, such as Python and the kernel.
Display version information and exits.
.TP
\fIcset\fR \-\-help
Prints the synopsis and a list of all commands.
.TP
\fIcset\fR \-\-log <filename>
Creates a log file for the current run. All manner of useful information is stored in this file. This is usually used to debug cpuset when things don't go as planned.
Creates a log file for the current run. All manner of useful information is stored in this file. This is usually used to debug cpuset when things don\(cqt go as planned.
.TP
\fIcset\fR help \fIcommand\fR
Although not strictly an "option", this is a very helpful way to execute help with cpuset. The command prints out a lengthy summary of how the specified subcommand works.
\fIcset\fR \-\-machine
Makes cset output information for all operations in a format that is machine readable (i.e. easy to parse).
.TP
\fIcset\fR \-\-tohex <CPUSPEC>
Converts a CPUSPEC (see \fIcset\-set(1)\fR for definition) to a hexadecimal number and outputs it. Useful for setting IRQ stub affinity to a cpuset definition.
.SH "CPUSET COMMANDS"
The cpuset commands are divided into groups, according to the primary purpose of those commands. Following is a short description of each command. A more detailed description is available in individual command manpages. Those manpages are named \fIcset\-<command>(1)\fR. The first command, \fIhelp\fR, is especially useful as it prints out a long summary of what a particular command does.
.TP
\fIcset help\fR
print the detailed command usage
.TP
\fIcset version\fR
display version information
\fIcset help command\fR
print out a lengthy summary of how the specified subcommand works
.TP
\fIcset copyright\fR
display copyright information
\fIcset command \-\-help\fR
print out an extended synopsis of the specified subcommand
.TP
\fIcset shield\fR
supercommand to set up and manage basic shielding (see \fBcset\-shield\fR(1))
supercommand to set up and manage basic shielding (see \fIcset\-shield(1)\fR)
.TP
\fIcset set\fR
create, modify and destroy cpusets (see \fBcset\-set\fR(1))
create, modify and destroy cpusets (see \fIcset\-set(1)\fR)
.TP
\fIcset proc\fR
create and manage processes within cpusets (see \fBcset\-proc\fR(1))
create and manage processes within cpusets (see \fIcset\-proc(1)\fR)
.SH "FILES"
Cpuset uses a configuration file if present on the system. The file is \fI/etc/cset.conf\fR and may contain the following options.
.TP
mountpoint = <directory_name>
Specify the mountpoint where the cpuset filesystem is to be mounted. By default this is \fI/cpusets\fR; however, some people prefer to mount this in the more traditional \fI/dev/cpusets\fR.
.SH "LICENSE"
Cpuset is licensed under the GNU GPL V2 only.
.SH "COPYRIGHT"
Copyright (c) 2008 Novell Inc.
Copyright (c) 2008\-2009 Novell Inc.
.SH "AUTHOR"
Written by Alex Tsariounov <alext@novell.com>.
Written by Alex Tsariounov <alext@novell.com>
Some substrate code and ideas were taken from the excellent Stacked GIT (stgit) v0.13 (see http://gna.org/projects/stgit and http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
.SH "SEE ALSO"
\fBcset\-set\fR(1), \fBcset\-proc\fR(1), \fBcset\-shield\fR(1), \fBtaskset\fR(1), \fBchrt\fR(1)
cset\-set(1), cset\-proc(1), cset\-shield(1)
/usr/share/doc/packages/cpuset/html/tutorial.html
taskset(1), chrt(1)
/usr/src/linux/Documentation/cpusets.txt

@ -3,7 +3,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.1.0" />
<meta name="generator" content="AsciiDoc 8.3.3" />
<title>cset(1)</title>
<style type="text/css">
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
@ -26,10 +27,12 @@ a:visited {
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
tt {
@ -44,13 +47,18 @@ h1, h2, h3, h4, h5, h6 {
line-height: 1.3;
}
h1 {
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
border-bottom: 2px solid silver;
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
div.sectionbody {
font-family: serif;
@ -66,6 +74,10 @@ p {
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
pre {
padding: 0;
margin: 0;
@ -118,6 +130,7 @@ div.content { /* Block element content. */
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
text-align: left;
@ -153,13 +166,25 @@ div.listingblock > div.content {
padding: 0.5em;
}
div.quoteblock > div.content {
div.quoteblock {
padding-left: 2.0em;
}
div.attribution {
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock {
padding-left: 2.0em;
}
div.verseblock > div.content {
white-space: pre;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
@ -182,10 +207,6 @@ div.exampleblock > div.content {
padding: 0.5em;
}
div.verseblock div.content {
white-space: pre;
}
div.imageblock div.content { padding-left: 0; }
div.imageblock img { border: 1px solid silver; }
span.image img { border-style: none; }
@ -197,18 +218,38 @@ dl {
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: italic;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0;
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.olist2 {
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
div.tableblock > table {
border: 3px solid #527bbd;
@ -220,19 +261,49 @@ thead {
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.hlist {
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
td.hlist1 {
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: italic;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hlist2 {
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
@media print {
div#footer-badges { display: none; }
@ -247,14 +318,40 @@ div#toctitle {
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2 {
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
/* Overrides for manpage documents */
h1 {
padding-top: 0.5em;
padding-bottom: 0.5em;
border-top: 2px solid silver;
border-bottom: 2px solid silver;
}
h2 {
border-style: none;
}
include1::./stylesheets/xhtml11-manpage.css[]
div.sectionbody {
margin-left: 5%;
}
@media print {
div#toc { display: none; }
}
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
@ -263,6 +360,7 @@ div.sidebar-content {
padding: 0.5em;
}
div.sidebar-title, div.image-title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
margin-top: 0.0em;
@ -275,8 +373,17 @@ div.listingblock div.content {
padding: 0.5em;
}
div.quoteblock-content {
padding-left: 2.0em;
div.quoteblock-attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock-content {
white-space: pre;
}
div.verseblock-attribution {
padding-top: 0.75em;
text-align: left;
}
div.exampleblock-content {
@ -287,7 +394,6 @@ div.exampleblock-content {
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }
</style>
<title>cset(1)</title>
</head>
<body>
<div id="header">
@ -304,11 +410,13 @@ cset(1) Manual Page
<h2>SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
<div class="content"><em>cset</em> [--version | --help | --log]
<div class="verseblock-content"><em>cset</em> [--version | --help | --tohex]
<em>cset</em> [help &lt;command&gt; | &lt;command&gt; --help]
<em>cset</em> [cset options] &lt;command&gt; [command options] [args]</div></div>
<em>cset</em> [cset options] &lt;command&gt; [command options] [args]</div>
<div class="verseblock-attribution">
</div></div>
</div>
<h2>DESCRIPTION</h2>
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="admonitionblock">
<table><tr>
@ -320,14 +428,14 @@ tool mounts the cpusets filesystem and manipulates it. Non-root users
do not have permission for these actions.</td>
</tr></table>
</div>
<p>Cpuset is a Python application to make using the cpusets facilities in
<div class="paragraph"><p>Cpuset is a Python application to make using the cpusets facilities in
the Linux kernel easier. The actual included command is called <em>cset</em>
and it allows manipulation of cpusets on the system and provides
higher level functions such as implementation and control of a basic
cpu shielding setup.</p>
<h3>Typical uses of cpuset include</h3>
<dl>
<dt>
cpu shielding setup.</p></div>
<h3 id="_typical_uses_of_cpuset_include">Typical uses of cpuset include</h3><div style="clear:left"></div>
<div class="dlist"><dl>
<dt class="hdlist1">
Setting up and managing a simple shielded CPU environment
</dt>
<dd>
@ -336,12 +444,12 @@ Setting up and managing a simple shielded CPU environment
cpus are partitioned off on the system and only processes that
are of interest are run on these cpus (i.e., inside the shield).
</p>
<p>For a simple shielded configuration, one typically uses three cpusets:
<div class="paragraph"><p>For a simple shielded configuration, one typically uses three cpusets:
the root set, a system set and a user set. <em>Cset</em> includes a super
command that implements this strategy and lets you easily manage it.
See <a href="cset-shield.html">cset-shield(1)</a> for more details.</p>
See <em>cset-shield(1)</em> for more details.</p></div>
</dd>
<dt>
<dt class="hdlist1">
Setting up and managing a comples shielding environment
</dt>
<dd>
@ -349,53 +457,51 @@ Setting up and managing a comples shielding environment
Shielding can be more complex of course where concepts such as
priority cpusets and intersecting cpuset can be used. You can
use <em>cset</em> to help manage this type of shielding as well. You
will need to use the <a href="cset-set.html">cset-set(1)</a> and <a href="cset-proc.html">cset-proc(1)</a>
will need to use the <em>cset-set(1)</em> and <em>cset-proc(1)</em>
subcommands directly to do that.
</p>
</dd>
<dt>
<dt class="hdlist1">
Managing cpusets on the system
</dt>
<dd>
<p>
The cset subcommand <a href="cset-set.html">cset-set(1)</a> allows you to create and
The cset subcommand <em>cset-set(1)</em> allows you to create and
destroy arbitrary cpusets on the system and assign arbitrary
cpus and memory nodes to them. The cpusets so created have to
follow the Linux kernel cpuset rules. See the <a href="cset-set.html">cset-set(1)</a>
follow the Linux kernel cpuset rules. See the <em>cset-set(1)</em>
subcommand for more details.
</p>
</dd>
<dt>
<dt class="hdlist1">
Managing processes that run on various system cpusets
</dt>
<dd>
<p>
The cset subcommand <a href="cset-proc.html">cset-proc(1)</a> allows you to manage
The cset subcommand <em>cset-proc(1)</em> allows you to manage
processes running on various cpusets created on the system.
You can exec new processes in specific cpusets and move tasks
around existing cpusets. See the <a href="cset-proc.html">cset-proc(1)</a> subcommand
around existing cpusets. See the <em>cset-proc(1)</em> subcommand
for more details.
</p>
</dd>
</dl>
</dl></div>
</div>
<h2>OPTIONS</h2>
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<p>The following generic option flags are available. Additional options
<div class="paragraph"><p>The following generic option flags are available. Additional options
are available per-command, and documented in the command-specific
documentation.</p>
<dl>
<dt>
documentation.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
<em>cset</em> --version
</dt>
<dd>
<p>
Prints the cpuset suite version that the <em>cset</em> program came
from, as well as version of other components used, such as
Python and the kernel.
Display version information and exits.
</p>
</dd>
<dt>
<dt class="hdlist1">
<em>cset</em> --help
</dt>
<dd>
@ -403,114 +509,134 @@ documentation.</p>
Prints the synopsis and a list of all commands.
</p>
</dd>
<dt>
<dt class="hdlist1">
<em>cset</em> --log &lt;filename&gt;
</dt>
<dd>
<p>
Creates a log file for the current run. All manner of useful
information is stored in this file. This is usually used to
debug cpuset when things don't go as planned.
debug cpuset when things don&#8217;t go as planned.
</p>
</dd>
<dt>
<em>cset</em> help <em>command</em>
<dt class="hdlist1">
<em>cset</em> --machine
</dt>
<dd>
<p>
Although not strictly an "option", this is a very helpful way
to execute help with cpuset. The command prints out a lengthy
summary of how the specified subcommand works.
Makes cset output information for all operations in a format
that is machine readable (i.e. easy to parse).
</p>
</dd>
</dl>
<dt class="hdlist1">
<em>cset</em> --tohex &lt;CPUSPEC&gt;
</dt>
<dd>
<p>
Converts a CPUSPEC (see <em>cset-set(1)</em> for definition) to a
hexadecimal number and outputs it. Useful for setting IRQ
stub affinity to a cpuset definition.
</p>
</dd>
</dl></div>
</div>
<h2>CPUSET COMMANDS</h2>
<h2 id="_cpuset_commands">CPUSET COMMANDS</h2>
<div class="sectionbody">
<p>The cpuset commands are divided into groups, according to the primary
<div class="paragraph"><p>The cpuset commands are divided into groups, according to the primary
purpose of those commands. Following is a short description of each
command. A more detailed description is available in individual
command manpages. Those manpages are named <em>cset-&lt;command&gt;(1)</em>. The
first command, <em>help</em>, is especially useful as it prints out a long
summary of what a particular command does.</p>
<dl>
<dt>
<em>cset help</em>
</dt>
<dd>
<p>
print the detailed command usage
</p>
</dd>
<dt>
<em>cset version</em>
summary of what a particular command does.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
<em>cset help command</em>
</dt>
<dd>
<p>
display version information
print out a lengthy summary of how the specified subcommand
works
</p>
</dd>
<dt>
<em>cset copyright</em>
<dt class="hdlist1">
<em>cset command --help</em>
</dt>
<dd>
<p>
display copyright information
print out an extended synopsis of the specified subcommand
</p>
</dd>
<dt>
<dt class="hdlist1">
<em>cset shield</em>
</dt>
<dd>
<p>
supercommand to set up and manage basic shielding (see
<a href="cset-shield.html">cset-shield(1)</a>)
<em>cset-shield(1)</em>)
</p>
</dd>
<dt>
<dt class="hdlist1">
<em>cset set</em>
</dt>
<dd>
<p>
create, modify and destroy cpusets (see <a href="cset-set.html">cset-set(1)</a>)
create, modify and destroy cpusets (see <em>cset-set(1)</em>)
</p>
</dd>
<dt>
<dt class="hdlist1">
<em>cset proc</em>
</dt>
<dd>
<p>
create and manage processes within cpusets (see
<a href="cset-proc.html">cset-proc(1)</a>)
<em>cset-proc(1)</em>)
</p>
</dd>
</dl></div>
</div>
<h2 id="_files">FILES</h2>
<div class="sectionbody">
<div class="paragraph"><p>Cpuset uses a configuration file if present on the system. The file
is <em>/etc/cset.conf</em> and may contain the following options.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
mountpoint = &lt;directory_name&gt;
</dt>
<dd>
<p>
Specify the mountpoint where the cpuset filesystem is to be
mounted. By default this is <em>/cpusets</em>; however, some people
prefer to mount this in the more traditional <em>/dev/cpusets</em>.
</p>
</dd>
</dl>
</dl></div>
</div>
<h2>LICENSE</h2>
<h2 id="_license">LICENSE</h2>
<div class="sectionbody">
<p>Cpuset is licensed under the GNU GPL V2 only.</p>
<div class="paragraph"><p>Cpuset is licensed under the GNU GPL V2 only.</p></div>
</div>
<h2>COPYRIGHT</h2>
<h2 id="_copyright">COPYRIGHT</h2>
<div class="sectionbody">
<p>Copyright (c) 2008 Novell Inc.</p>
<div class="paragraph"><p>Copyright (c) 2008-2009 Novell Inc.</p></div>
</div>
<h2>AUTHOR</h2>
<h2 id="_author">AUTHOR</h2>
<div class="sectionbody">
<p>Written by Alex Tsariounov &lt;alext@novell.com&gt;.</p>
<p>Some substrate code and ideas were taken from the excellent Stacked
<div class="paragraph"><p>Written by Alex Tsariounov &lt;alext@novell.com&gt;</p></div>
<div class="paragraph"><p>Some substrate code and ideas were taken from the excellent Stacked
GIT (stgit) v0.13 (see http://gna.org/projects/stgit and
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.</p>
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.</p></div>
</div>
<h2>SEE ALSO</h2>
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<p><a href="cset-set.html">cset-set(1)</a>, <a href="cset-proc.html">cset-proc(1)</a>, <a href="cset-shield.html">cset-shield(1)</a>, <a href="taskset.html">taskset(1)</a>,
<a href="chrt.html">chrt(1)</a></p>
<p>/usr/src/linux/Documentation/cpusets.txt</p>
<div class="paragraph"><p>cset-set(1), cset-proc(1), cset-shield(1)</p></div>
<div class="paragraph"><p>/usr/share/doc/packages/cpuset/html/tutorial.html</p></div>
<div class="paragraph"><p>taskset(1), chrt(1)</p></div>
<div class="paragraph"><p>/usr/src/linux/Documentation/cpusets.txt</p></div>
</div>
<div id="footer">
<div id="footer-text">
Version 1.0<br />
Last updated 30-May-2008 14:33:24 MDT
Last updated 2009-02-07 18:55:58 MDT
</div>
</div>
</body>

@ -10,7 +10,7 @@ cset - manage cpusets functions in the Linux kernel
SYNOPSIS
--------
[verse]
'cset' [--version | --help | --log]
'cset' [--version | --help | --tohex]
'cset' [help <command> | <command> --help]
'cset' [cset options] <command> [command options] [args]
@ -37,27 +37,27 @@ Setting up and managing a simple shielded CPU environment::
For a simple shielded configuration, one typically uses three cpusets:
the root set, a system set and a user set. 'Cset' includes a super
command that implements this strategy and lets you easily manage it.
See csetlink:shield[] for more details.
See 'cset-shield(1)' for more details.
Setting up and managing a comples shielding environment::
Shielding can be more complex of course where concepts such as
priority cpusets and intersecting cpuset can be used. You can
use 'cset' to help manage this type of shielding as well. You
will need to use the csetlink:set[] and csetlink:proc[]
will need to use the 'cset-set(1)' and 'cset-proc(1)'
subcommands directly to do that.
Managing cpusets on the system::
The cset subcommand csetlink:set[] allows you to create and
The cset subcommand 'cset-set(1)' allows you to create and
destroy arbitrary cpusets on the system and assign arbitrary
cpus and memory nodes to them. The cpusets so created have to
follow the Linux kernel cpuset rules. See the csetlink:set[]
follow the Linux kernel cpuset rules. See the 'cset-set(1)'
subcommand for more details.
Managing processes that run on various system cpusets::
The cset subcommand csetlink:proc[] allows you to manage
The cset subcommand 'cset-proc(1)' allows you to manage
processes running on various cpusets created on the system.
You can exec new processes in specific cpusets and move tasks
around existing cpusets. See the csetlink:proc[] subcommand
around existing cpusets. See the 'cset-proc(1)' subcommand
for more details.
OPTIONS
@ -67,9 +67,7 @@ are available per-command, and documented in the command-specific
documentation.
'cset' --version::
Prints the cpuset suite version that the 'cset' program came
from, as well as version of other components used, such as
Python and the kernel.
Display version information and exits.
'cset' --help::
Prints the synopsis and a list of all commands.
@ -79,10 +77,14 @@ documentation.
information is stored in this file. This is usually used to
debug cpuset when things don't go as planned.
'cset' help 'command'::
Although not strictly an "option", this is a very helpful way
to execute help with cpuset. The command prints out a lengthy
summary of how the specified subcommand works.
'cset' --machine::
Makes cset output information for all operations in a format
that is machine readable (i.e. easy to parse).
'cset' --tohex <CPUSPEC>::
Converts a CPUSPEC (see 'cset-set(1)' for definition) to a
hexadecimal number and outputs it. Useful for setting IRQ
stub affinity to a cpuset definition.
CPUSET COMMANDS
---------------
@ -93,20 +95,30 @@ command manpages. Those manpages are named 'cset-<command>(1)'. The
first command, 'help', is especially useful as it prints out a long
summary of what a particular command does.
'cset help'::
print the detailed command usage
'cset version'::
display version information
'cset copyright'::
display copyright information
'cset help command'::
print out a lengthy summary of how the specified subcommand
works
'cset command --help'::
print out an extended synopsis of the specified subcommand
'cset shield'::
supercommand to set up and manage basic shielding (see
csetlink:shield[])
'cset-shield(1)')
'cset set'::
create, modify and destroy cpusets (see csetlink:set[])
create, modify and destroy cpusets (see 'cset-set(1)')
'cset proc'::
create and manage processes within cpusets (see
csetlink:proc[])
'cset-proc(1)')
FILES
-----
Cpuset uses a configuration file if present on the system. The file
is '/etc/cset.conf' and may contain the following options.
mountpoint = <directory_name>::
Specify the mountpoint where the cpuset filesystem is to be
mounted. By default this is '/cpusets'; however, some people
prefer to mount this in the more traditional '/dev/cpusets'.
LICENSE
-------
@ -114,19 +126,22 @@ Cpuset is licensed under the GNU GPL V2 only.
COPYRIGHT
---------
Copyright (c) 2008 Novell Inc.
Copyright (c) 2008-2009 Novell Inc.
AUTHOR
------
Written by Alex Tsariounov <alext@novell.com>.
Written by Alex Tsariounov <\alext@novell.com>
Some substrate code and ideas were taken from the excellent Stacked
GIT (stgit) v0.13 (see http://gna.org/projects/stgit and
http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
GIT (stgit) v0.13 (see \http://gna.org/projects/stgit and
\http://www.procode.org/stgit). Stacked GIT is under GPL V2 or later.
SEE ALSO
--------
csetlink:set[], csetlink:proc[], csetlink:shield[], manlink:taskset[1],
manlink:chrt[1]
cset-set(1), cset-proc(1), cset-shield(1)
/usr/share/doc/packages/cpuset/html/tutorial.html
taskset(1), chrt(1)
/usr/src/linux/Documentation/cpusets.txt

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -20,7 +20,7 @@ setup(name = 'cpuset',
scripts = ['cset'],
packages = ['cpuset', 'cpuset.commands'],
data_files = [
('share/doc/packages/cpuset', ['README', 'COPYING']),
('share/doc/packages/cpuset', ['README', 'COPYING', 'AUTHORS', 'NEWS', 'INSTALL']),
('share/doc/packages/cpuset', glob.glob('doc/*.html')),
('share/doc/packages/cpuset', glob.glob('doc/*.txt')),
]

Loading…
Cancel
Save