Commit d425b274 authored by Con Kolivas's avatar Con Kolivas Committed by Linus Torvalds

[PATCH] sched: activate SCHED BATCH expired

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: default avatarCon Kolivas <kernel@kolivas.org>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7c4bb1f9
...@@ -484,6 +484,7 @@ struct signal_struct { ...@@ -484,6 +484,7 @@ struct signal_struct {
#define MAX_PRIO (MAX_RT_PRIO + 40) #define MAX_PRIO (MAX_RT_PRIO + 40)
#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) #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.. * Some day this will be a full-fledged user tracking system..
......
...@@ -667,9 +667,13 @@ static int effective_prio(task_t *p) ...@@ -667,9 +667,13 @@ static int effective_prio(task_t *p)
/* /*
* __activate_task - move a task to the runqueue. * __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);
rq->nr_running++; rq->nr_running++;
} }
...@@ -688,7 +692,7 @@ static int recalc_task_prio(task_t *p, unsigned long long now) ...@@ -688,7 +692,7 @@ static int recalc_task_prio(task_t *p, unsigned long long now)
unsigned long long __sleep_time = now - p->timestamp; unsigned long long __sleep_time = now - p->timestamp;
unsigned long sleep_time; unsigned long sleep_time;
if (unlikely(p->policy == SCHED_BATCH)) if (batch_task(p))
sleep_time = 0; sleep_time = 0;
else { else {
if (__sleep_time > NS_MAX_SLEEP_AVG) if (__sleep_time > NS_MAX_SLEEP_AVG)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment