2008-03-05 02:10:43 +00:00
|
|
|
.\" Copyright (c) 2008 Christian Brueffer
|
|
|
|
.\" Copyright (c) 2008 Jeffrey Roberson
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2015-01-08 18:53:11 +00:00
|
|
|
.Dd January 8, 2015
|
2008-03-05 02:10:43 +00:00
|
|
|
.Dt CPUSET 1
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm cpuset
|
|
|
|
.Nd "configure processor sets"
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Op Fl l Ar cpu-list
|
|
|
|
.Op Fl s Ar setid
|
2008-12-13 15:44:29 +00:00
|
|
|
.Ar cmd ...
|
2008-03-05 02:10:43 +00:00
|
|
|
.Nm
|
|
|
|
.Op Fl l Ar cpu-list
|
|
|
|
.Op Fl s Ar setid
|
|
|
|
.Fl p Ar pid
|
|
|
|
.Nm
|
2011-01-14 19:57:28 +00:00
|
|
|
.Op Fl c
|
|
|
|
.Op Fl l Ar cpu-list
|
|
|
|
.Fl C
|
|
|
|
.Fl p Ar pid
|
|
|
|
.Nm
|
2015-01-08 15:53:13 +00:00
|
|
|
.Op Fl c
|
2008-03-05 02:10:43 +00:00
|
|
|
.Op Fl l Ar cpu-list
|
2008-12-13 15:44:29 +00:00
|
|
|
.Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
|
2008-03-05 02:10:43 +00:00
|
|
|
.Nm
|
2015-01-08 15:53:13 +00:00
|
|
|
.Fl g
|
|
|
|
.Op Fl cir
|
|
|
|
.Op Fl d Ar domain | j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
|
2008-03-05 02:10:43 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
command can be used to assign processor sets to processes, run commands
|
|
|
|
constrained to a given set or list of processors, and query information
|
|
|
|
about processor binding, sets, and available processors in the system.
|
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
requires a target to modify or query.
|
MFp4:
Bring in updated jail support from bz_jail branch.
This enhances the current jail implementation to permit multiple
addresses per jail. In addtion to IPv4, IPv6 is supported as well.
Due to updated checks it is even possible to have jails without
an IP address at all, which basically gives one a chroot with
restricted process view, no networking,..
SCTP support was updated and supports IPv6 in jails as well.
Cpuset support permits jails to be bound to specific processor
sets after creation.
Jails can have an unrestricted (no duplicate protection, etc.) name
in addition to the hostname. The jail name cannot be changed from
within a jail and is considered to be used for management purposes
or as audit-token in the future.
DDB 'show jails' command was added to aid debugging.
Proper compat support permits 32bit jail binaries to be used on 64bit
systems to manage jails. Also backward compatibility was preserved where
possible: for jail v1 syscalls, as well as with user space management
utilities.
Both jail as well as prison version were updated for the new features.
A gap was intentionally left as the intermediate versions had been
used by various patches floating around the last years.
Bump __FreeBSD_version for the afore mentioned and in kernel changes.
Special thanks to:
- Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
and Olivier Houchard (cognet) for initial single-IPv6 patches.
- Jeff Roberson (jeff) and Randall Stewart (rrs) for their
help, ideas and review on cpuset and SCTP support.
- Robert Watson (rwatson) for lots and lots of help, discussions,
suggestions and review of most of the patch at various stages.
- John Baldwin (jhb) for his help.
- Simon L. Nielsen (simon) as early adopter testing changes
on cluster machines as well as all the testers and people
who provided feedback the last months on freebsd-jail and
other channels.
- My employer, CK Software GmbH, for the support so I could work on this.
Reviewed by: (see above)
MFC after: 3 months (this is just so that I get the mail)
X-MFC Before: 7.2-RELEASE if possible
2008-11-29 14:32:14 +00:00
|
|
|
The target may be specified as a command, process id, thread id, a
|
2015-01-08 15:53:13 +00:00
|
|
|
cpuset id, an irq, a jail id, or a NUMA domain.
|
2008-03-05 02:10:43 +00:00
|
|
|
Using
|
|
|
|
.Fl g
|
|
|
|
the target's set id or mask may be queried.
|
|
|
|
Using
|
|
|
|
.Fl l
|
|
|
|
or
|
|
|
|
.Fl s
|
|
|
|
the target's CPU mask or set id may be set.
|
|
|
|
If no target is specified,
|
|
|
|
.Nm
|
|
|
|
operates on itself.
|
|
|
|
Not all combinations of operations and targets are supported.
|
|
|
|
For example,
|
|
|
|
you may not set the id of an existing set or query and launch a command
|
|
|
|
at the same time.
|
|
|
|
.Pp
|
|
|
|
There are two sets applicable to each process and one private mask per thread.
|
|
|
|
Every process in the system belongs to a cpuset.
|
|
|
|
By default processes are started in set 1.
|
|
|
|
The mask or id may be queried using
|
|
|
|
.Fl c .
|
|
|
|
Each thread also has a private mask of CPUs it is allowed to run
|
|
|
|
on that must be a subset of the assigned set.
|
|
|
|
And finally, there is a root set, numbered 0, that is immutable.
|
|
|
|
This last set is the list of all possible CPUs in the system and is
|
|
|
|
queried using
|
|
|
|
.Fl r .
|
|
|
|
.Pp
|
|
|
|
When running a command it may join a set specified with
|
|
|
|
.Fl s
|
|
|
|
otherwise a new set is created.
|
2008-03-12 23:54:40 +00:00
|
|
|
In addition, a mask for the command may be specified using
|
2008-03-05 02:10:43 +00:00
|
|
|
.Fl l .
|
2008-03-12 23:54:40 +00:00
|
|
|
When used in conjunction with
|
|
|
|
.Fl c
|
|
|
|
the mask modifies the supplied or created set rather than the private mask
|
|
|
|
for the thread.
|
2008-03-05 02:10:43 +00:00
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width ".Fl l Ar cpu-list"
|
2011-01-14 19:57:28 +00:00
|
|
|
.It Fl C
|
|
|
|
Create a new cpuset and assign the target process to that set.
|
2008-03-05 02:10:43 +00:00
|
|
|
.It Fl c
|
|
|
|
The requested operation should reference the cpuset available via the
|
|
|
|
target specifier.
|
2015-01-08 15:53:13 +00:00
|
|
|
.It Fl d Ar domain
|
|
|
|
Specifies a NUMA domain id as the target of the operation.
|
2008-03-05 02:10:43 +00:00
|
|
|
.It Fl g
|
|
|
|
Causes
|
|
|
|
.Nm
|
2008-12-13 15:44:29 +00:00
|
|
|
to print either a list of valid CPUs or, using
|
2008-03-05 02:10:43 +00:00
|
|
|
.Fl i ,
|
|
|
|
the id of the target.
|
|
|
|
.It Fl i
|
|
|
|
When used with the
|
|
|
|
.Fl g
|
|
|
|
option print the id rather than the valid mask of the target.
|
MFp4:
Bring in updated jail support from bz_jail branch.
This enhances the current jail implementation to permit multiple
addresses per jail. In addtion to IPv4, IPv6 is supported as well.
Due to updated checks it is even possible to have jails without
an IP address at all, which basically gives one a chroot with
restricted process view, no networking,..
SCTP support was updated and supports IPv6 in jails as well.
Cpuset support permits jails to be bound to specific processor
sets after creation.
Jails can have an unrestricted (no duplicate protection, etc.) name
in addition to the hostname. The jail name cannot be changed from
within a jail and is considered to be used for management purposes
or as audit-token in the future.
DDB 'show jails' command was added to aid debugging.
Proper compat support permits 32bit jail binaries to be used on 64bit
systems to manage jails. Also backward compatibility was preserved where
possible: for jail v1 syscalls, as well as with user space management
utilities.
Both jail as well as prison version were updated for the new features.
A gap was intentionally left as the intermediate versions had been
used by various patches floating around the last years.
Bump __FreeBSD_version for the afore mentioned and in kernel changes.
Special thanks to:
- Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
and Olivier Houchard (cognet) for initial single-IPv6 patches.
- Jeff Roberson (jeff) and Randall Stewart (rrs) for their
help, ideas and review on cpuset and SCTP support.
- Robert Watson (rwatson) for lots and lots of help, discussions,
suggestions and review of most of the patch at various stages.
- John Baldwin (jhb) for his help.
- Simon L. Nielsen (simon) as early adopter testing changes
on cluster machines as well as all the testers and people
who provided feedback the last months on freebsd-jail and
other channels.
- My employer, CK Software GmbH, for the support so I could work on this.
Reviewed by: (see above)
MFC after: 3 months (this is just so that I get the mail)
X-MFC Before: 7.2-RELEASE if possible
2008-11-29 14:32:14 +00:00
|
|
|
.It Fl j Ar jailid
|
|
|
|
Specifies a jail id as the target of the operation.
|
2008-03-05 02:10:43 +00:00
|
|
|
.It Fl l Ar cpu-list
|
|
|
|
Specifies a list of CPUs to apply to a target.
|
|
|
|
Specification may include
|
2008-03-11 14:48:59 +00:00
|
|
|
numbers separated by '-' for ranges and commas separating individual numbers.
|
2011-01-14 19:57:28 +00:00
|
|
|
A special list of
|
|
|
|
.Dq all
|
|
|
|
may be specified in which case the list includes all CPUs from the root set.
|
2008-03-05 02:10:43 +00:00
|
|
|
.It Fl p Ar pid
|
|
|
|
Specifies a pid as the target of the operation.
|
2008-12-13 15:44:29 +00:00
|
|
|
.It Fl s Ar setid
|
2008-03-05 02:10:43 +00:00
|
|
|
Specifies a set id as the target of the operation.
|
|
|
|
.It Fl r
|
|
|
|
The requested operation should reference the root set available via the
|
|
|
|
target specifier.
|
|
|
|
.It Fl t Ar tid
|
|
|
|
Specifies a thread id as the target of the operation.
|
2008-12-13 15:44:29 +00:00
|
|
|
.It Fl x Ar irq
|
MFp4:
Bring in updated jail support from bz_jail branch.
This enhances the current jail implementation to permit multiple
addresses per jail. In addtion to IPv4, IPv6 is supported as well.
Due to updated checks it is even possible to have jails without
an IP address at all, which basically gives one a chroot with
restricted process view, no networking,..
SCTP support was updated and supports IPv6 in jails as well.
Cpuset support permits jails to be bound to specific processor
sets after creation.
Jails can have an unrestricted (no duplicate protection, etc.) name
in addition to the hostname. The jail name cannot be changed from
within a jail and is considered to be used for management purposes
or as audit-token in the future.
DDB 'show jails' command was added to aid debugging.
Proper compat support permits 32bit jail binaries to be used on 64bit
systems to manage jails. Also backward compatibility was preserved where
possible: for jail v1 syscalls, as well as with user space management
utilities.
Both jail as well as prison version were updated for the new features.
A gap was intentionally left as the intermediate versions had been
used by various patches floating around the last years.
Bump __FreeBSD_version for the afore mentioned and in kernel changes.
Special thanks to:
- Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
and Olivier Houchard (cognet) for initial single-IPv6 patches.
- Jeff Roberson (jeff) and Randall Stewart (rrs) for their
help, ideas and review on cpuset and SCTP support.
- Robert Watson (rwatson) for lots and lots of help, discussions,
suggestions and review of most of the patch at various stages.
- John Baldwin (jhb) for his help.
- Simon L. Nielsen (simon) as early adopter testing changes
on cluster machines as well as all the testers and people
who provided feedback the last months on freebsd-jail and
other channels.
- My employer, CK Software GmbH, for the support so I could work on this.
Reviewed by: (see above)
MFC after: 3 months (this is just so that I get the mail)
X-MFC Before: 7.2-RELEASE if possible
2008-11-29 14:32:14 +00:00
|
|
|
Specifies an irq as the target of the operation.
|
2008-03-05 02:10:43 +00:00
|
|
|
.El
|
|
|
|
.Sh EXIT STATUS
|
|
|
|
.Ex -std
|
|
|
|
.Sh EXAMPLES
|
|
|
|
Create a new group with CPUs 0-4 inclusive and run
|
|
|
|
.Pa /bin/sh
|
|
|
|
on it:
|
2008-03-12 23:54:40 +00:00
|
|
|
.Dl cpuset -c -l 0-4 /bin/sh
|
2008-03-05 02:10:43 +00:00
|
|
|
.Pp
|
|
|
|
Query the mask of CPUs the
|
|
|
|
.Aq sh pid
|
|
|
|
is allowed to run on:
|
|
|
|
.Dl cpuset -g -p <sh pid>
|
|
|
|
.Pp
|
|
|
|
Restrict
|
|
|
|
.Pa /bin/sh
|
|
|
|
to run on CPUs 0 and 2 while its group is still allowed to run on
|
|
|
|
CPUs 0-4:
|
|
|
|
.Dl cpuset -l 0,2 -p <sh pid>
|
|
|
|
.Pp
|
|
|
|
Modify the cpuset
|
|
|
|
.Pa /bin/sh
|
|
|
|
belongs to restricting it to CPUs 0 and 2:
|
|
|
|
.Dl cpuset -l 0,2 -c -p <sh pid>
|
|
|
|
.Pp
|
|
|
|
Modify the cpuset all threads are in by default to contain only
|
|
|
|
the first 4 CPUs, leaving the rest idle:
|
|
|
|
.Dl cpuset -l 0-3 -s 1
|
|
|
|
.Pp
|
|
|
|
Print the id of the cpuset
|
|
|
|
.Pa /bin/sh
|
|
|
|
is in:
|
|
|
|
.Dl cpuset -g -i -p <sh pid>
|
|
|
|
.Pp
|
|
|
|
Move the
|
|
|
|
.Ar pid
|
|
|
|
into the specified cpuset
|
|
|
|
.Ar setid
|
|
|
|
so it may be managed with other pids in that set:
|
|
|
|
.Dl cpuset -s <setid> -p <pid>
|
2011-01-14 19:57:28 +00:00
|
|
|
.Pp
|
|
|
|
Create a new cpuset that is restricted to CPUs 0 and 2 and move
|
|
|
|
.Ar pid
|
|
|
|
into the new set:
|
|
|
|
.Dl cpuset -C -c -l 0,2 -p <pid>
|
2008-03-05 02:10:43 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr cpuset 2
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
command first appeared in
|
2008-09-29 15:44:48 +00:00
|
|
|
.Fx 7.1 .
|
2008-03-05 02:10:43 +00:00
|
|
|
.Sh AUTHORS
|
2014-06-23 08:23:05 +00:00
|
|
|
.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
|