Re: 2.0.32 items

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Sat, 15 Nov 1997 00:24:23 +0100


here is another small patch which would be very nice to have in 2.0.32.

I got it quite a while ago from Ingo Molnar and adds one new scheduler class
which will run tasks only iff the machine is really idle and won't compete
even with `nice 19' jobs.

We've used this for >6 months now on many machines for idle tasks
e.g. for the RC5 56bti cracking effort which wouldn't have been
possible otherwise.

So it's really usefull for some production machines and thus should
get into 2.0.x series since it can't have any bad side effects
(pretty obvious from this small patch, isn't it?)

-------------------------------------------------------------------------------
diff -ur linux/include/linux/sched.h ./include/linux/sched.h
--- linux/include/linux/sched.h Sat Mar 29 01:08:17 1997
+++ ./include/linux/sched.h Thu Apr 17 13:35:48 1997
@@ -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;
@@ -210,7 +211,8 @@
struct wait_queue *wait_chldexit; /* for wait4() */
unsigned short uid,euid,suid,fsuid;
unsigned short gid,egid,sgid,fsgid;
- unsigned long timeout, policy, rt_priority;
+ unsigned long timeout, policy;
+ long rt_priority;
unsigned long it_real_value, it_prof_value, it_virt_value;
unsigned long it_real_incr, it_prof_incr, it_virt_incr;
struct timer_list real_timer;
diff -ur linux/kernel/sched.c ./kernel/sched.c
--- linux/kernel/sched.c Tue Apr 8 17:47:47 1997
+++ ./kernel/sched.c Tue Apr 29 18:29:39 1997
@@ -1380,7 +1380,7 @@
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;

/*
@@ -1399,7 +1399,15 @@
return -EPERM;

p->policy = policy;
- p->rt_priority = lp.sched_priority;
+
+ if (policy == SCHED_IDLE)
+ /*
+ * look into goodness() before complaining ;)
+ */
+ p->rt_priority = -1999 + lp.sched_priority;
+ else
+ p->rt_priority = lp.sched_priority;
+
cli();
if (p->next_run)
move_last_runqueue(p);
-------------------------------------------------------------------------------

Harald

--
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^