idle priority

Solar Designer (solar@false.com)
Sun, 9 Aug 1998 09:32:30 +0400 (MSD)


Hi,

Can we get something like this into the standard kernel, finally?

--- linux-2.0.35/include/linux/sched.h Sat Jul 18 22:54:22 1998
+++ linux/include/linux/sched.h Wed Aug 5 06:30:50 1998
@@ -93,6 +93,7 @@
#define SCHED_OTHER 0
#define SCHED_FIFO 1
#define SCHED_RR 2
+#define SCHED_IDLE 3

struct sched_param {
int sched_priority;
--- linux-2.0.35/kernel/sched.c Sat Jul 18 22:46:51 1998
+++ linux/kernel/sched.c Wed Aug 5 09:24:52 1998
@@ -253,6 +253,9 @@
#endif
#endif

+ if (p->policy == SCHED_IDLE)
+ return -999;
+
/*
* Realtime process, select the first one on the
* runqueue (taking priorities within processes
@@ -1468,16 +1471,18 @@
if (policy < 0)
policy = p->policy;
else if (policy != SCHED_FIFO && policy != SCHED_RR &&
- policy != SCHED_OTHER)
+ policy != SCHED_OTHER && policy != SCHED_IDLE)
return -EINVAL;

/*
* Valid priorities for SCHED_FIFO and SCHED_RR are 1..99, valid
- * priority for SCHED_OTHER is 0.
+ * priority for SCHED_OTHER and SCHED_IDLE is 0.
*/
- if (lp.sched_priority < 0 || lp.sched_priority > 99)
+ if (policy == SCHED_FIFO || policy == SCHED_RR)
+ if (lp.sched_priority < 1 || lp.sched_priority > 99)
return -EINVAL;
- if ((policy == SCHED_OTHER) != (lp.sched_priority == 0))
+ if (policy == SCHED_OTHER || policy == SCHED_IDLE)
+ if (lp.sched_priority != 0)
return -EINVAL;

if ((policy == SCHED_FIFO || policy == SCHED_RR) && !suser())
@@ -1561,6 +1566,7 @@
case SCHED_RR:
return 99;
case SCHED_OTHER:
+ case SCHED_IDLE:
return 0;
}

@@ -1574,6 +1580,7 @@
case SCHED_RR:
return 1;
case SCHED_OTHER:
+ case SCHED_IDLE:
return 0;
}

@@ -1641,7 +1648,7 @@
return -EINVAL;

if (t.tv_sec == 0 && t.tv_nsec <= 2000000L &&
- current->policy != SCHED_OTHER) {
+ current->policy != SCHED_OTHER && current->policy != SCHED_IDLE) {
/*
* Short delay requests up to 2 ms will be handled with
* high precision by a busy wait for all real-time processes.

Signed,
Solar Designer

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html