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>
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>
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>
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>
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>
In several languages the translations for "current" and "new" will
have to be slightly different depending on whether they apply to
"policy" or "priority". (As a general rule, translatable messages
should be full sentences, and not partial ones with optional words
filled in via %s.)
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
This new option allows to set SCHED_RESET_ON_FORK flag for FIFO and RR
policies.
Example:
$ chrt --fifo --reset-on-fork 1 /bin/bash
$ schedutils/chrt --pid $$
pid 31579's current scheduling policy: SCHED_FIFO|SCHED_RESET_ON_FORK
pid 31579's current scheduling priority: 1
Signed-off-by: Karel Zak <kzak@redhat.com>
From 9262c9832134f8a33ac2ea2854dc6d20acc712d1 Mon Sep 17 00:00:00 2001
From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Date: Tue, 2 Feb 2010 16:57:23 +0100
Subject: [PATCH] Add support for SCHED_RESET_ON_FORK to chrt
SCHED_RESET_ON_FORK has been added in 2.6.31. If a thread has this flag
set, chrt reports "unknown" policy, which is confusing.
The patch adds support for this new flag. It will (can) only be applied
to SCHED_FIFO or SCHED_RR, so there's no need to catch the other
scheduling policies.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
SCHED_FIFO, SCHED_OTHER, SCHED_RR are part of POSIX 1003.1b Process
Scheduling, so it is correct to assume they always exists.
SCHED_BATCH and SCHED_IDLE are Linux specific, we should not assume
they exists.
Defining SCHED_BATCH and SCHED_IDLE to random values (ie the ones found
on Linux systems) is not an option as they may *collide* with the one of
other systems. For example on GNU/kFreeBSD we have:
#define SCHED_RR 3
and on Linux we have:
#define SCHED_BATCH 3
[kzak@redhat.com: - add "Linux specific" notes to chrt.1
- add a note about BATCH and PR conflict to
this commit message]
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
% chrt -i 0 ./a.out &
[1] 60479
% chrt -p 60479
pid 60479's current scheduling policy: SCHED_IDLE
SCHED_RR
pid 60479's current scheduling priority: 0
We have a spurious and incorrect SCHED_RR in there...
Address-Red-Hat-Bugzilla: #483706
Signed-off-by: Karel Zak <kzak@redhat.com>