Messages in this thread Patch in this message |  | | | Date | Sun, 13 Apr 1997 19:19:00 +0200 (MET DST) | | From | Ingo Molnar <> | | Subject | Re: how to set priority for idle process ? |
| |
On Sun, 13 Apr 1997, Harald Koenig wrote:
> hmm, maybe my mail wasn't clear enough. I'll try to explain the real aim again: > > I'd like to have a processes doing real and reasonable computations > only and really only if nothing else is running on the system. > it should not even try to compete with jobs running with "nice 19". > this is what I'm calling my "idle task". > > the "while (1);" loop was only a short replacement for the real computation...
maybe we could (ab)-use the RT system calls to set 'idle' priority for processes. (priority which is unsettable with the normal Posix system calls)
[some time passes]
what about this patch. Idle priority seems to fit into setscheduler() nicely.
[i hope it doesnt break Posix?]
--- sched.h.orig Sun Apr 13 19:11:15 1997 +++ sched.h Sun Apr 13 19:11:41 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; @@ -212,7 +213,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; --- sched.c.orig Sun Apr 13 19:04:17 1997 +++ sched.c Sun Apr 13 19:09:22 1997 @@ -1485,7 +1485,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; /* @@ -1504,7 +1504,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; + else + p->rt_priority = lp.sched_priority; + spin_lock(&scheduler_lock); spin_lock_irq(&runqueue_lock); if (p->next_run)
|  |