* [PATCH] Support for CFS SCHED_IDLE priority in chrt
@ 2008-09-23 12:35 Martin Steigerwald
2008-09-23 21:39 ` Karel Zak
0 siblings, 1 reply; 4+ messages in thread
From: Martin Steigerwald @ 2008-09-23 12:35 UTC (permalink / raw)
To: util-linux-ng; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4908 bytes --]
Please keep CC to linux-kernel or CC to me personally as I am not subscribed
to util-linux-ng.
Hi!
Since I do not dare to break kernel code[1], I try the same with userspace
code. The following patch should add SCHED_IDLE support to chrt. Beware it is
complety untested, since I get:
ms@mango> autoconf ~/lokal/Kernel/Dokumentation/util-linux-ng
configure.ac:7: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:37: error: possibly undefined macro: AM_CONDITIONAL
configure.ac:190: error: possibly undefined macro: AM_GNU_GETTEXT_VERSION
configure.ac:191: error: possibly undefined macro: AM_GNU_GETTEXT
ms@mango> ./configure ~/lokal/Kernel/Dokumentation/util-linux-ng
configure: error: cannot find install-sh or install.sh in config "."/config
when trying to compile util-linux-ng from GIT. (Note: I have no glue about
autoconf, I only ever started an pre-existing ./configure script). I tried
with autoconf 2.61-8 from Debian Lenny.
I will test this commit if someone gives me a hint on how to compile
util-linux-ng.
[1] http://marc.info/?l=linux-kernel&m=122217132330769&w=2
---
From 8c6c5154bc5b53c0ccad8faa0ee3fe07bae447a5 Mon Sep 17 00:00:00 2001
From: Martin Steigerwald <ms@teamix.de>
Date: Tue, 23 Sep 2008 14:23:03 +0200
Subject: [PATCH] Support CFS SCHED_IDLE priority and document it
Support CFS_SCHED_IDLE priority and document it.
Beware, this is completely untested, since I autoconf 2.61-8 from Debian
Lenny produced errors.
Signed-off-by: Martin Steigerwald <ms@teamix.de>
---
schedutils/chrt.1 | 11 +++++++++--
schedutils/chrt.c | 23 +++++++++++++++++++++++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/schedutils/chrt.1 b/schedutils/chrt.1
index dbc2958..67a9421 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 ba07dbe..5da8f6b 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' },
@@ -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;
--
Martin Steigerwald - team(ix) GmbH - http://www.teamix.de
gpg: 19E3 8D42 896F D004 08AC A0CA 1E10 C593 0399 AE90
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Support for CFS SCHED_IDLE priority in chrt
2008-09-23 12:35 [PATCH] Support for CFS SCHED_IDLE priority in chrt Martin Steigerwald
@ 2008-09-23 21:39 ` Karel Zak
2008-09-24 7:13 ` Martin Steigerwald
0 siblings, 1 reply; 4+ messages in thread
From: Karel Zak @ 2008-09-23 21:39 UTC (permalink / raw)
To: Martin Steigerwald; +Cc: util-linux-ng, linux-kernel
On Tue, Sep 23, 2008 at 02:35:49PM +0200, Martin Steigerwald wrote:
> ms@mango> autoconf ~/lokal/Kernel/Dokumentation/util-linux-ng
> configure.ac:7: error: possibly undefined macro: AM_INIT_AUTOMAKE
> If this token and others are legitimate, please use m4_pattern_allow.
> See the Autoconf documentation.
> configure.ac:37: error: possibly undefined macro: AM_CONDITIONAL
> configure.ac:190: error: possibly undefined macro: AM_GNU_GETTEXT_VERSION
> configure.ac:191: error: possibly undefined macro: AM_GNU_GETTEXT
> ms@mango> ./configure ~/lokal/Kernel/Dokumentation/util-linux-ng
> configure: error: cannot find install-sh or install.sh in config "."/config
>
> when trying to compile util-linux-ng from GIT. (Note: I have no glue about
> autoconf, I only ever started an pre-existing ./configure script). I tried
> with autoconf 2.61-8 from Debian Lenny.
./autogen.sh
> I will test this commit if someone gives me a hint on how to compile
> util-linux-ng.
see README.devel
Applied with minor changes, thanks.
Karel
--
Karel Zak <kzak@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Support for CFS SCHED_IDLE priority in chrt
2008-09-23 21:39 ` Karel Zak
@ 2008-09-24 7:13 ` Martin Steigerwald
2008-09-24 7:42 ` Karel Zak
0 siblings, 1 reply; 4+ messages in thread
From: Martin Steigerwald @ 2008-09-24 7:13 UTC (permalink / raw)
To: util-linux-ng, linux-kernel; +Cc: Karel Zak, Ingo Molnar
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
Am Dienstag, 23. September 2008 schrieben Sie:
> On Tue, Sep 23, 2008 at 02:35:49PM +0200, Martin Steigerwald wrote:
> > ms@mango> autoconf ~/lokal/Kernel/Dokumentation/util-linux-ng
> > configure.ac:7: error: possibly undefined macro: AM_INIT_AUTOMAKE
> > If this token and others are legitimate, please use
> > m4_pattern_allow. See the Autoconf documentation.
> > configure.ac:37: error: possibly undefined macro: AM_CONDITIONAL
> > configure.ac:190: error: possibly undefined macro: AM_GNU_GETTEXT_VERSION
> > configure.ac:191: error: possibly undefined macro: AM_GNU_GETTEXT
> > ms@mango> ./configure ~/lokal/Kernel/Dokumentation/util-linux-ng
> > configure: error: cannot find install-sh or install.sh in config
> > "."/config
> >
> > when trying to compile util-linux-ng from GIT. (Note: I have no glue
> > about autoconf, I only ever started an pre-existing ./configure script).
> > I tried with autoconf 2.61-8 from Debian Lenny.
>
> ./autogen.sh
Thanks.
> > I will test this commit if someone gives me a hint on how to compile
> > util-linux-ng.
>
> see README.devel
Ok, was a RTFM, sorry... I read INSTALL and didn't notice README.devel.
> Applied with minor changes, thanks.
Do you know in which util-linux-ng version it will appear? Then I could send
Ingo another sched-design-CFS.txt update patch.
Ciao,
--
Martin Steigerwald - team(ix) GmbH - http://www.teamix.de
gpg: 19E3 8D42 896F D004 08AC A0CA 1E10 C593 0399 AE90
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Support for CFS SCHED_IDLE priority in chrt
2008-09-24 7:13 ` Martin Steigerwald
@ 2008-09-24 7:42 ` Karel Zak
0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2008-09-24 7:42 UTC (permalink / raw)
To: Martin Steigerwald; +Cc: util-linux-ng, linux-kernel, Ingo Molnar
On Wed, Sep 24, 2008 at 09:13:11AM +0200, Martin Steigerwald wrote:
> > Applied with minor changes, thanks.
>
> Do you know in which util-linux-ng version it will appear? Then I could send
2.15 -- probably at end of this year.
> Ingo another sched-design-CFS.txt update patch.
Karel
--
Karel Zak <kzak@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-24 7:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-23 12:35 [PATCH] Support for CFS SCHED_IDLE priority in chrt Martin Steigerwald
2008-09-23 21:39 ` Karel Zak
2008-09-24 7:13 ` Martin Steigerwald
2008-09-24 7:42 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox