Batch scheduling for 2.6.0-test7
PATCH 1/1 Batch scheduling for 2.6.0-test7
T o allow a simple upgrade path for people moving from 2.4 -ck to 2.6 I have implemented a very basic batch scheduling for 2.6.
Batch tasks are designed to run with minimal impact on system load (ie long calculation tasks such as setiathome, mprime, dnetc).
This design uses an extra array (batch) for each runqueue. Batch tasks are activated onto the batch array and only run when there are no normal or real time tasks that need running. Batch tasks have much longer timeslices (still dependent on "nice") but yield immediately when cpu is required. They do not preempt each other (one batch task will wait for another batch task to complete it's timeslice before running regardless of nice value).
An example of how effective batch scheduling is as follows:
kernel compile with the same loadno_load 87.32user 10.74system 1:45.06elapsed 93%CPUnormal_load 87.03user 10.62system 3:32.58elapsed 45%CPUniced_load 87.07user 10.72system 1:54.52elapsed 85%CPU
batchload 87.00user 10.65system 1:44.75elapsed 93%CPU
In this example, a kernel is compiled at idle, and with a simple but difficult to control load (while true ; do a=1 ; done). The run time for the kernel compile is almost twice as long when the load is not reniced, and ten seconds longer when it is reniced to 19. When the load is batch scheduled it takes no extra time (smaller number is within deviation between runs I suspect).
Note that no effort is made to tame batch tasks' effect on other resources (disk i/o, vm pressure etc) so they cannot be truly weightless.
kernel compiled as batch task
batchrun 88.33user 10.82system 1:45.60elapsed 93%CPU
Here it is compiled as a batch task itself, and you can see it takes more user time, but equivalent overall time. The machine was running X at the time so presumably this is causing some more overhead.
Schedtools to modify scheduler policy can be found here:
http://freshmeat.net/projects/schedtool/?topic_id=136
and the patch can be found here (latest is batch2):
http://ck.kolivas.org/patches/2.6/2.6.0-test7/
This has only been tested on uniprocessor systems and I am not pushing for inclusion in mainline. This is not meant to be a comprehensive batch scheduling implementation but a simple upgrade path for 2.4 -ck users as I am retiring from all kernel development work for personal reasons of time. Please consider this if you wish to email me.
Regards,
Con Kolivas
include/linux/sched.h +2 -0
@@ -126,6 +126,7 @@ extern unsigned long nr_iowait(void);#define SCHED_NORMAL 0#define SCHED_FIFO 1#define SCHED_RR 2 +#define SCHED_BATCH 3struct sched_param {int sched_priority;
@@ -294,6 +295,7 @@ struct signal_struct {#define MAX_PRIO (MAX_RT_PRIO + 40)#define rt_task (p) ((p)->prio < MAX_RT_PRIO) +#define batch_task (p) ((p)->policy == SCHED_BATCH)/* * Some day this will be a full-fledged user tracking system..
kernel/sched.c +74 -24
216 lines not on this page · raw message