From: Con Kolivas To increase the strength of SCHED_BATCH as a scheduling hint we can activate batch tasks on the expired array since by definition they are latency insensitive tasks. Signed-off-by: Con Kolivas Acked-by: Ingo Molnar Signed-off-by: Andrew Morton --- include/linux/sched.h | 1 + kernel/sched.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff -puN include/linux/sched.h~sched-activate-sched-batch-expired include/linux/sched.h --- 25/include/linux/sched.h~sched-activate-sched-batch-expired Fri Mar 17 17:00:15 2006 +++ 25-akpm/include/linux/sched.h Fri Mar 17 17:00:15 2006 @@ -483,6 +483,7 @@ struct signal_struct { #define MAX_PRIO (MAX_RT_PRIO + 40) #define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) +#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH)) /* * Some day this will be a full-fledged user tracking system.. diff -puN kernel/sched.c~sched-activate-sched-batch-expired kernel/sched.c --- 25/kernel/sched.c~sched-activate-sched-batch-expired Fri Mar 17 17:00:15 2006 +++ 25-akpm/kernel/sched.c Fri Mar 17 17:00:15 2006 @@ -735,9 +735,13 @@ static inline void dec_nr_running(task_t /* * __activate_task - move a task to the runqueue. */ -static inline void __activate_task(task_t *p, runqueue_t *rq) +static void __activate_task(task_t *p, runqueue_t *rq) { - enqueue_task(p, rq->active); + prio_array_t *target = rq->active; + + if (batch_task(p)) + target = rq->expired; + enqueue_task(p, target); inc_nr_running(p, rq); } @@ -756,7 +760,7 @@ static int recalc_task_prio(task_t *p, u unsigned long long __sleep_time = now - p->timestamp; unsigned long sleep_time; - if (unlikely(p->policy == SCHED_BATCH)) + if (batch_task(p)) sleep_time = 0; else { if (__sleep_time > NS_MAX_SLEEP_AVG) _