diff options
author | Con Kolivas <kernel@kolivas.org> | 2006-03-31 05:31:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:59 -0500 |
commit | d425b274ba83ba4e7746a40446ec0ba3267de51f (patch) | |
tree | 73d3342be7ba8ef8d18a8c3cc9fea6e026e2bffa | |
parent | 7c4bb1f9b3788309e1159961c606ba0bdf7ed382 (diff) |
[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: Con Kolivas <kernel@kolivas.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | kernel/sched.c | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index c4fd3fcd3feb..78c40dd2e19a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -484,6 +484,7 @@ struct signal_struct { | |||
484 | #define MAX_PRIO (MAX_RT_PRIO + 40) | 484 | #define MAX_PRIO (MAX_RT_PRIO + 40) |
485 | 485 | ||
486 | #define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) | 486 | #define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) |
487 | #define batch_task(p) (unlikely((p)->policy == SCHED_BATCH)) | ||
487 | 488 | ||
488 | /* | 489 | /* |
489 | * Some day this will be a full-fledged user tracking system.. | 490 | * Some day this will be a full-fledged user tracking system.. |
diff --git a/kernel/sched.c b/kernel/sched.c index 73bb4d9ef989..dd153d6f8a04 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -667,9 +667,13 @@ static int effective_prio(task_t *p) | |||
667 | /* | 667 | /* |
668 | * __activate_task - move a task to the runqueue. | 668 | * __activate_task - move a task to the runqueue. |
669 | */ | 669 | */ |
670 | static inline void __activate_task(task_t *p, runqueue_t *rq) | 670 | static void __activate_task(task_t *p, runqueue_t *rq) |
671 | { | 671 | { |
672 | enqueue_task(p, rq->active); | 672 | prio_array_t *target = rq->active; |
673 | |||
674 | if (batch_task(p)) | ||
675 | target = rq->expired; | ||
676 | enqueue_task(p, target); | ||
673 | rq->nr_running++; | 677 | rq->nr_running++; |
674 | } | 678 | } |
675 | 679 | ||
@@ -688,7 +692,7 @@ static int recalc_task_prio(task_t *p, unsigned long long now) | |||
688 | unsigned long long __sleep_time = now - p->timestamp; | 692 | unsigned long long __sleep_time = now - p->timestamp; |
689 | unsigned long sleep_time; | 693 | unsigned long sleep_time; |
690 | 694 | ||
691 | if (unlikely(p->policy == SCHED_BATCH)) | 695 | if (batch_task(p)) |
692 | sleep_time = 0; | 696 | sleep_time = 0; |
693 | else { | 697 | else { |
694 | if (__sleep_time > NS_MAX_SLEEP_AVG) | 698 | if (__sleep_time > NS_MAX_SLEEP_AVG) |