Some time back, I moved the discussion of scheduling from
sched_setscheduler(2) to a new sched(7) page. Adjust the cross
reference in the taskset(1) page accordingly.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This patch does only the following:
* Order SEE ALSO entries first by section name, then alphabetically
within section
* Adds one or two missing commas in SEE ALSO lists
* Removes one or two periods that were (inconsistently) used
at the end of SEE ALSO lists.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Broken since 6f27e449. We could not enter the fallback
if HAVE_SCHED_SETATTR is not defined.
Two gcc warnings made this issue visible:
schedutils/chrt.c:247:1: warning: label 'fallback' defined but not used [-Wunused-label]
schedutils/chrt.c:266:9: warning: 'policy' may be used uninitialized in this function [-Wuninitialized]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* do not reset 'nice' setting by sched_setattr(), if 'nice' setting
is not zero then chrt ends with EPERM for non-root users:
$ renice -n 5 -p $$; chrt -v -b 0 date
12475 (process ID) old priority 0, new priority 5
chrt: failed to set pid 0's policy: Operation not permitted
* it seems more elegant to always use old sched_setscheduler() API for
non-deadline policies; in this case we do not need getpriority()
to keep 'nice' unchanged.
Addresses: https://github.com/karelzak/util-linux/issues/359
Signed-off-by: Karel Zak <kzak@redhat.com>
The man page confusingly says that the mask is "typically"
hexadecimal, when in fact it is always hexadecimal. Fix the
language, and provide an additional example with no leading "0x".
Also, provide an example using the --cpu-list option.
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
We have fallback for compilation with/without proper glibc and kernel
headers, but it's not enough, because people can switch between
kernels with and without the syscalls. (For example RT kernels for
RHEL/CentOS).
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1353340
Signed-off-by: Karel Zak <kzak@redhat.com>
Before this patch, it wasn't clear whether '0' or '7' should be used to
specify "highest priority". (The answer could have been inferred from
the 'Examples' section of the man page.)
Signed-off-by: Daniel Shahaf <danielsh@apache.org>
Earlier message:
$ chrt -i 1 ls
chrt: failed to set pid 0's policy: Invalid argument
basically told 'something failed', while the new one tries to be more
helpful.
$ chrt -i 1 ls
chrt: unsupported priority value for the policy: 1: see --max for valid range
Addresses: https://bugs.debian.org/791707
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Commit 42f15e9848 introduced a certain
inaccuracy in -c option description; it is not _the option with an argument_,
but it is the flag that changes interpretation of `mask` parameter.
The difference is almost not noticeable, but there are one corner case where it is:
taskset -c 1 -p $$
fails (but it would work if 42f15e was correct). Instead,
taskset -c -p 1 $$
works (but it should not have if 42f15e was correct).
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch introduces
-d, --deadline
-T, --sched-runtime
-D, --sched-deadline
-P, --sched-period
command line options. The functionality is available only for Linux with
sched_setattr() [kernel >=3.14]
Signed-off-by: Karel Zak <kzak@redhat.com>
Transform some of them into copyright lines.
Also fix three header lines and snip some trailing whitespace.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
This makes it match the license of the man pages.
While there, also tweak some other comment lines.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Done for ease of translation and maintenance. Also improve the
clarity of some of the descriptions, and of one error message.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
ioprio_get and ioprio_set system call accept not only process ID but
also process group ID(pgid) and user ID(uid) to specify the target
process(es). However, ionice command accepts only process ID. With
this patch a user can specify the target processes with pgid(-P
option) and uid(-u option).
[kzak@redhat.com: - tiny cleanup in usage()]
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
A user is always allowed to change the CPU affinity of his or her
own processes. CAP_SYS_NICE is only required to change the affinity
of another user's process.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Joe Mario <jmario@redhat.com>
And mention in manual that the default is referring to the internal
default of this command, not the Linux system default. Manual page
example also tries to be a little more complete how to use the command.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The unsuspecting user might use taskset -a mask command. Behavior then
is to exec with no affinity applied at all. Better handled by ignoring
all_tasks if no pid was given.
Signed-off-by: Daniel Stodden <daniel.stodden@gmail.com>
The global variable $(LDADD) is always used if program_LDADD is
not specified. Let's use $LDADD everywhere to avoid exceptions for
people who need to specify global $LDADD.
Signed-off-by: Karel Zak <kzak@redhat.com>
Several horizontal lists are turned to vertical, and sorted to
alphabetical order. Additionally spaces are converted to tabs where
ever possible.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Use dates without the day, use the full month name, put "util-linux" in
the lower left corner, and "User Commands" or "System Administration"
at the top center.
Also improve here and there the one-line program description.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
This is a preparation patch for chcpu. If a cpu should be added to
a cpu_set where the cpu doesn't fit into the cpu_set this got silently
ignored.
Since the cpu-list is user space provided it should be checked if cpus
are specified that are completely out of range of the system.
In order to do that add a parameter which specifies if cpulist_parse()
should fail if it parses a cpu-list with "impossible" cpus.
The current callers have been converted so they behave like before.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* replace errx() with warnx() for unknown -c class
The right place to check I/O scheduler features is in kernel. We should
not try to be more smart than kernel.
* make the code ready (robust) for unknown sched.classes
* fix -t behavior
old version:
$ ionice -c 4 -t bash
ionice: bad prio class 4
new version:
$ ionice -c 4 -t bash
Reported-by: Voelker, Bernhard" <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
ionice : print the current I/O prio.
ionice COMMAND : exec command with default (best-effort) class
ionice -p PID [...] : return info about the PID(s)
ionice -c CLASS COMMAND : exec command with the class
ionice -c CLASS -p PID [...] : modify PID(s) class
This should be backwardly compatible and also compatible with nice(1)
from coreutils.
Signed-off-by: Karel Zak <kzak@redhat.com>
taskset.c should add these lines:
#include <sched.h> for sched_getaffinity, etc
#include <stddef.h> for size_t
#include <string.h> for memset
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
$ ionice 123
none: prio 4
none: prio 4
It calls ioprio_get(0x1, 0) and ioprio_get(0x1, 123), because the
code does not check it the "-p" options was specified.
The proper command line syntax is:
$ ionice -p 123
and the ioprio_get() should be called only once.
Signed-off-by: Karel Zak <kzak@redhat.com>
* make the code more robust
* follow kernel conventions for variable names
(data = classdata, ioprio = classdata | class)
Signed-off-by: Karel Zak <kzak@redhat.com>
chrt.c:158:16: warning: comparison of integers of different
signs: 'int' and 'unsigned long' [-Wsign-compare]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
With this option we can operate on all the thread group of a process not just
for changes, but also when obtaining information via sched_getscheduler().
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Add a new '-a' option to view/modify the CPU affinity for an entire
group of threads belonging to a given PID. We create two new
functions, print_affinity() and do_taskset() for code simplification.
Example:
zeus@jilguero:~/src/util-linux/schedutils$ ./taskset -a -p 01 3142
pid 3142's current affinity mask: 2
pid 3142's new affinity mask: 1
pid 3164's current affinity mask: 2
pid 3164's new affinity mask: 1
pid 854's current affinity mask: 2
pid 854's new affinity mask: 1
[kzak@redhat.com: - clean up
- move variables to struct taskset]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Tested-by: Jonathan Gonzalez <zeus@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Currently this program works only with the master thread. Add a '-t'
option to propagate changes to the entire group of threads.
Example:
root@offworld:~/projects/util-linux/schedutils# ls /proc/2111/task/
2111 2112 2119 2121 2138 2139 2159 2160
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2111
pid 2111's current scheduling policy: SCHED_RR
pid 2111's current scheduling priority: 3
root@offworld:~/projects/util-linux/schedutils# ./chrt -t -p 2 2111
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2112
pid 2112's current scheduling policy: SCHED_RR
pid 2112's current scheduling priority: 2
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2111
pid 2111's current scheduling policy: SCHED_RR
pid 2111's current scheduling priority: 2
[kzak@redhat.com: - rename -t/--thread to -a/--all-tasks]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Solaris lacks err, errx, warn and warnx. This also means the err.h header
doesn't exist. Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
This patch replaces a few functions used throughout the source:
* Renames getnum (from schedutils) to strtol_or_err
* Moves strtosize (from lib/strtosize.c)
* Moves xstrncpy (from include/xstrncpy.h)
* Adds strnlen, strnchr and strndup if not available (remove it from libmount utils)
A few Makefile.am files were modified to compile accordingly along with trivial renaming
in schedutils source code.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>