summaryrefslogtreecommitdiffstats
path: root/schedutils
diff options
context:
space:
mode:
authorKarel Zak2007-01-16 15:24:13 +0100
committerKarel Zak2007-01-16 15:24:13 +0100
commitdf3773fba068c88ec4ce2d3b65dec57146d2b730 (patch)
tree7cfba406d9627e4331b76b47ad3d0804ece32974 /schedutils
parentschedutils: remove extra hyptens from man pages (diff)
downloadkernel-qcow2-util-linux-df3773fba068c88ec4ce2d3b65dec57146d2b730.tar.gz
kernel-qcow2-util-linux-df3773fba068c88ec4ce2d3b65dec57146d2b730.tar.xz
kernel-qcow2-util-linux-df3773fba068c88ec4ce2d3b65dec57146d2b730.zip
schedutils: add support for SCHED_BATCH
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'schedutils')
-rw-r--r--schedutils/chrt.17
-rw-r--r--schedutils/chrt.c26
2 files changed, 27 insertions, 6 deletions
diff --git a/schedutils/chrt.1 b/schedutils/chrt.1
index 6fe818201..9ffc084b5 100644
--- a/schedutils/chrt.1
+++ b/schedutils/chrt.1
@@ -36,10 +36,11 @@ chrt \- manipulate real-time attributes of a process
.BR chrt (1)
sets or retrieves the real-time scheduling attributes of an existing PID or
runs COMMAND with the given attributes. Both policy (one of
+.BR SCHED_OTHER ,
.BR SCHED_FIFO ,
.BR SCHED_RR ,
or
-.BR SCHED_OTHER )
+.BR SCHED_BATCH )
and priority can be set and retrieved.
.SH OPTIONS
.TP
@@ -48,6 +49,10 @@ operate on an existing PID and do not launch a new task
.TP
.TP
+.B -b, --batch
+set scheduling policy to
+.BR SCHED_BATCH
+.TP
.B -f, --fifo
set scheduling policy to
.BR SCHED_FIFO
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 7adff1c4f..4c190a82d 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -36,6 +36,8 @@ static void show_usage(const char *cmd)
fprintf(stderr, "usage: %s [options] [prio] [pid | cmd [args...]]\n",
cmd);
fprintf(stderr, "manipulate real-time attributes of a process\n");
+ fprintf(stderr, " -b, --batch "
+ "set policy to SCHED_BATCH\n");
fprintf(stderr, " -f, --fifo "
"set policy to SCHED_FF\n");
fprintf(stderr, " -p, --pid "
@@ -83,6 +85,9 @@ static void show_rt_info(const char *what, pid_t pid)
case SCHED_RR:
printf("SCHED_RR\n");
break;
+ case SCHED_BATCH:
+ printf("SCHED_BATCH\n");
+ break;
default:
printf("unknown\n");
}
@@ -101,6 +106,13 @@ static void show_min_max(void)
{
int max, min;
+ max = sched_get_priority_max(SCHED_OTHER);
+ min = sched_get_priority_min(SCHED_OTHER);
+ if (max >= 0 && min >= 0)
+ printf("SCHED_OTHER min/max priority\t: %d/%d\n", min, max);
+ else
+ printf("SCHED_OTHER not supported?\n");
+
max = sched_get_priority_max(SCHED_FIFO);
min = sched_get_priority_min(SCHED_FIFO);
if (max >= 0 && min >= 0)
@@ -115,12 +127,12 @@ static void show_min_max(void)
else
printf("SCHED_RR not supported?\n");
- max = sched_get_priority_max(SCHED_OTHER);
- min = sched_get_priority_min(SCHED_OTHER);
+ max = sched_get_priority_max(SCHED_BATCH);
+ min = sched_get_priority_min(SCHED_BATCH);
if (max >= 0 && min >= 0)
- printf("SCHED_OTHER min/max priority\t: %d/%d\n", min, max);
+ printf("SCHED_BATCH min/max priority\t: %d/%d\n", min, max);
else
- printf("SCHED_OTHER not supported?\n");
+ printf("SCHED_BATCH not supported?\n");
}
int main(int argc, char *argv[])
@@ -130,6 +142,7 @@ int main(int argc, char *argv[])
pid_t pid = 0;
struct option longopts[] = {
+ { "batch", 0, NULL, 'b' },
{ "fifo", 0, NULL, 'f' },
{ "pid", 0, NULL, 'p' },
{ "help", 0, NULL, 'h' },
@@ -141,11 +154,14 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0 }
};
- while((i = getopt_long(argc, argv, "+fphmorvV", longopts, NULL)) != -1)
+ while((i = getopt_long(argc, argv, "+bfphmorvV", longopts, NULL)) != -1)
{
int ret = 1;
switch (i) {
+ case 'b':
+ policy = SCHED_BATCH;
+ break;
case 'f':
policy = SCHED_FIFO;
break;