diff options
author | Martin Steigerwald <ms@teamix.de> | 2008-09-23 14:23:03 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2008-09-23 23:28:00 +0200 |
commit | c779d6e94ff6880a92213693c6bd955a7d167df9 (patch) | |
tree | 52bd63b122e97934e80d81715e40e9570f31e2bb /schedutils | |
parent | af53f0f1ca9ccebfded560eeaca50289a49e6fa5 (diff) | |
download | util-linux-old-c779d6e94ff6880a92213693c6bd955a7d167df9.tar.gz |
chrt: support CFS SCHED_IDLE priority and document it
Signed-off-by: Martin Steigerwald <ms@teamix.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'schedutils')
-rw-r--r-- | schedutils/chrt.1 | 11 | ||||
-rw-r--r-- | schedutils/chrt.c | 25 |
2 files changed, 33 insertions, 3 deletions
diff --git a/schedutils/chrt.1 b/schedutils/chrt.1 index dbc29589..a78ad255 100644 --- a/schedutils/chrt.1 +++ b/schedutils/chrt.1 @@ -45,13 +45,16 @@ runs COMMAND with the given attributes. Both policy (one of .BR SCHED_OTHER , .BR SCHED_FIFO , .BR SCHED_RR , +.BR SCHED_BATCH , or -.BR SCHED_BATCH ) +.BR SCHED_IDLE ) and priority can be set and retrieved. .PP The .BR SCHED_BATCH -policy is supported since Linux 2.6.16. +policy is supported since Linux 2.6.16. The +.BR SCHED_IDLE +policy is supported since Linux 2.6.23. .SH OPTIONS .TP .B -p, --pid @@ -65,6 +68,10 @@ set scheduling policy to set scheduling policy to .BR SCHED_FIFO .TP +.B -i, --idle +set schedulng policy to +.BR SCHED_IDLE +.TP .B -m, --max show minimum and maximum valid priorities, then exit .TP diff --git a/schedutils/chrt.c b/schedutils/chrt.c index ba07dbe1..92985c6e 100644 --- a/schedutils/chrt.c +++ b/schedutils/chrt.c @@ -35,6 +35,14 @@ # define SCHED_BATCH 3 #endif +/* the SCHED_IDLE is supported since Linux 2.6.23 + * commit id 0e6aca43e08a62a48d6770e9a159dbec167bf4c6 + * -- temporary workaround for people with old glibc headers + */ +#ifndef SCHED_IDLE +# define SCHED_IDLE 5 +#endif + static void show_usage(const char *cmd) { fprintf(stderr, "chrt (%s)\n", PACKAGE_STRING); @@ -45,6 +53,8 @@ static void show_usage(const char *cmd) "set policy to SCHED_BATCH\n"); fprintf(stderr, " -f, --fifo " "set policy to SCHED_FIFO\n"); + fprintf(stderr, " -i, --idle " + "set policy to SCHED_IDLE\n"); fprintf(stderr, " -p, --pid " "operate on existing given pid\n"); fprintf(stderr, " -m, --max " @@ -87,6 +97,8 @@ static void show_rt_info(const char *what, pid_t pid) case SCHED_FIFO: printf("SCHED_FIFO\n"); break; + case SCHED_IDLE: + printf("SCHED_IDLE\n"); case SCHED_RR: printf("SCHED_RR\n"); break; @@ -138,6 +150,13 @@ static void show_min_max(void) printf("SCHED_BATCH min/max priority\t: %d/%d\n", min, max); else printf("SCHED_BATCH not supported?\n"); + + max = sched_get_priority_max(SCHED_IDLE); + min = sched_get_priority_min(SCHED_IDLE); + if (max >= 0 && min >= 0) + printf("SCHED_IDLE min/max priority\t: %d/%d\n", min, max); + else + printf("SCHED_IDLE not supported?\n"); } int main(int argc, char *argv[]) @@ -149,6 +168,7 @@ int main(int argc, char *argv[]) struct option longopts[] = { { "batch", 0, NULL, 'b' }, { "fifo", 0, NULL, 'f' }, + { "idle", 0, NULL, 'i' }, { "pid", 0, NULL, 'p' }, { "help", 0, NULL, 'h' }, { "max", 0, NULL, 'm' }, @@ -159,7 +179,7 @@ int main(int argc, char *argv[]) { NULL, 0, NULL, 0 } }; - while((i = getopt_long(argc, argv, "+bfphmorvV", longopts, NULL)) != -1) + while((i = getopt_long(argc, argv, "+bfiphmorvV", longopts, NULL)) != -1) { int ret = 1; @@ -170,6 +190,9 @@ int main(int argc, char *argv[]) case 'f': policy = SCHED_FIFO; break; + case 'i': + policy = SCHED_IDLE; + break; case 'm': show_min_max(); return 0; |