diff -ru linux/Documentation/Configure.help /usr/src/linux/Documentation/Configure.help --- linux/Documentation/Configure.help Tue Feb 2 16:12:46 1999 +++ /usr/src/linux/Documentation/Configure.help Mon Feb 1 13:04:48 1999 @@ -854,6 +854,14 @@ ("Ctrl-h i") or with the program info ("man info"). Enabling this option enlarges your kernel by about 7kB. Just 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. + Kernel support for ELF binaries CONFIG_BINFMT_ELF ELF (Executable and Linkable Format) is a format for libraries and diff -ru linux/arch/i386/config.in /usr/src/linux/arch/i386/config.in --- linux/arch/i386/config.in Tue Feb 2 16:13:05 1999 +++ /usr/src/linux/arch/i386/config.in Mon Feb 1 13:02:05 1999 @@ -31,6 +31,7 @@ fi fi bool 'System V IPC' CONFIG_SYSVIPC +bool 'IDLE scheduling class' CONFIG_SCHED_IDLE tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then diff -ru linux/include/linux/sched.h /usr/src/linux/include/linux/sched.h --- linux/include/linux/sched.h Tue Feb 2 15:50:09 1999 +++ /usr/src/linux/include/linux/sched.h Mon Feb 1 13:08:12 1999 @@ -94,6 +94,18 @@ #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_SHCED_IDLE */ struct sched_param { int sched_priority; diff -ru linux/kernel/sched.c /usr/src/linux/kernel/sched.c --- linux/kernel/sched.c Tue Feb 2 15:49:15 1999 +++ /usr/src/linux/kernel/sched.c Mon Feb 1 20:24:25 1999 @@ -240,6 +240,9 @@ */ static inline int goodness(struct task_struct * p, struct task_struct * prev, int this_cpu) { +#ifdef CONFIG_SCHED_IDLE + int policy = p->policy; +#endif int weight; #ifdef __SMP__ @@ -258,7 +261,12 @@ * runqueue (taking priorities within processes * into account). */ +#ifdef CONFIG_SCHED_IDLE + if (policy == SCHED_RR || + policy == SCHED_FIFO) +#else if (p->policy != SCHED_OTHER) +#endif /* CONFIG_SCHED_IDLE */ return 1000 + p->rt_priority; /* @@ -283,7 +291,14 @@ weight += 1; } +#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 */ } @@ -457,7 +472,11 @@ } /* if all runnable processes have "counter == 0", re-calculate counters */ +#ifdef CONFIG_SCHED_IDLE + if (c <= SCHED_OTHER_PRIORITY) { +#else if (!c) { +#endif for_each_task(p) p->counter = (p->counter >> 1) + p->priority; } @@ -1468,7 +1487,11 @@ if (policy < 0) policy = p->policy; else if (policy != SCHED_FIFO && policy != SCHED_RR && - policy != SCHED_OTHER) + policy != SCHED_OTHER +#ifdef CONFIG_SCHED_IDLE + && policy != SCHED_IDLE +#endif + ) return -EINVAL; /*