diff -ru linux-2.2/Documentation/Configure.help linux-2.2-IDLE/Documentation/Configure.help --- linux-2.2/Documentation/Configure.help Tue Jan 26 18:40:04 1999 +++ linux-2.2-IDLE/Documentation/Configure.help Tue Jan 26 18:16:16 1999 @@ -1437,6 +1437,14 @@ user level program to do useful things with this information. This is generally a good idea, so say Y. +IDLE scheduling class +CONFIG_SCHED_IDLE + This option will create an additional scheduling class that + may be used to run background process (such as distributed.net) + without degrading system performance. If any other processes + desire CPU resources, processes running with the SCHED_IDLE + scheduling class will be starved off the CPU. + Sysctl support CONFIG_SYSCTL The sysctl interface provides a means of dynamically changing diff -ru linux-2.2/arch/i386/config.in linux-2.2-IDLE/arch/i386/config.in --- linux-2.2/arch/i386/config.in Tue Jan 26 18:40:22 1999 +++ linux-2.2-IDLE/arch/i386/config.in Tue Jan 26 14:41:47 1999 @@ -83,6 +83,7 @@ bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT +bool 'IDLE scheduling class' CONFIG_SCHED_IDLE bool 'Sysctl support' CONFIG_SYSCTL tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF diff -ru linux-2.2/arch/ppc/config.in linux-2.2-IDLE/arch/ppc/config.in --- linux-2.2/arch/ppc/config.in Tue Jan 26 18:40:42 1999 +++ linux-2.2-IDLE/arch/ppc/config.in Tue Jan 26 14:42:08 1999 @@ -57,6 +57,7 @@ bool 'Sysctl support' CONFIG_SYSCTL bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT +bool 'IDLE scheduling class' CONFIG_SCHED_IDLE # only elf supported, a.out is not -- Cort define_bool CONFIG_BINFMT_ELF y diff -ru linux-2.2/include/linux/sched.h linux-2.2-IDLE/include/linux/sched.h --- linux-2.2/include/linux/sched.h Tue Jan 26 18:43:26 1999 +++ linux-2.2-IDLE/include/linux/sched.h Tue Jan 26 16:56:06 1999 @@ -87,6 +87,20 @@ #define SCHED_FIFO 1 #define SCHED_RR 2 + +#ifdef CONFIG_SCHED_IDLE +#define SCHED_IDLE 3 + +/* + * Scheduling priority values + */ +#define SCHED_RR_PRIORITY 1000 +#define SCHED_FIFO_PRIORITY 1000 +#define SCHED_OTHER_PRIORITY 500 +#define SCHED_IDLE_PRIORITY 0 + +#endif /* CONFIG_SCHED_IDLE */ + /* * This is an additional bit set when we want to * yield the CPU for one re-schedule.. diff -ru linux-2.2/kernel/sched.c linux-2.2-IDLE/kernel/sched.c --- linux-2.2/kernel/sched.c Tue Jan 26 18:43:34 1999 +++ linux-2.2-IDLE/kernel/sched.c Tue Jan 26 17:15:16 1999 @@ -350,8 +350,14 @@ * runqueue (taking priorities within processes * into account). */ - if (policy != SCHED_OTHER) + if (policy == SCHED_RR || policy == SCHED_FIFO) return 1000 + p->rt_priority; +/* WIP CONFIG_SCHED_IDLE + if (policy == SCHED_RR ) + return SCHED_RR_PRIORITY + p->rt_priority; + else if (policy == SCHED_FIFO) + return SCHED_FIFO_PRIORITY + p->rt_priority; +*/ /* * Give the process a first-approximation goodness value @@ -376,7 +382,14 @@ weight += p->priority; } +#ifdef CONFIG_SCHED_IDLE + if (policy == SCHED_OTHER) + return SCHED_OTHER_PRIORITY + weight; + else + return SCHED_IDLE_PRIORITY + weight; +#else return weight; +#endif /* CONFIG_SCHED_IDLE */ } /* @@ -716,7 +729,11 @@ } /* Do we need to re-calculate counters? */ +#ifdef CONFIG_SCHED_IDLE + if (c <= SCHED_OTHER_PRIORITY) { +#else if (!c) { +#endif struct task_struct *p; read_lock(&tasklist_lock); for_each_task(p) @@ -1621,7 +1638,11 @@ else { retval = -EINVAL; if (policy != SCHED_FIFO && policy != SCHED_RR && - policy != SCHED_OTHER) + policy != SCHED_OTHER +#ifdef CONFIG_SCHED_IDLE + && policy != SCHED_IDLE +#endif + ) goto out_unlock; }