diff options
author | Darren Hart <dvhart@linux.intel.com> | 2011-02-22 16:04:33 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-03-04 05:14:29 -0500 |
commit | a2f5c9ab79f78e8b91ac993e0543d65b661dd19b (patch) | |
tree | 9fcdae7cad6745d02d5389ab591b454bb4c17b60 /kernel/sched_fair.c | |
parent | e0a92c17470775cd85bac52f5372ccc3dc58254a (diff) |
sched: Allow SCHED_BATCH to preempt SCHED_IDLE tasks
Perform the test for SCHED_IDLE before testing for SCHED_BATCH (and
ensure idle tasks don't preempt idle tasks) so the non-interactive,
but still important, SCHED_BATCH tasks will run in favor of the very
low priority SCHED_IDLE tasks.
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Mike Galbraith <efault@gmx.de>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
LKML-Reference: <1298408674-3130-2-git-send-email-dvhart@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r-- | kernel/sched_fair.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 3a88dee165c0..1438e13cf8be 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -1870,16 +1870,18 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ | |||
1870 | if (test_tsk_need_resched(curr)) | 1870 | if (test_tsk_need_resched(curr)) |
1871 | return; | 1871 | return; |
1872 | 1872 | ||
1873 | /* Idle tasks are by definition preempted by non-idle tasks. */ | ||
1874 | if (unlikely(curr->policy == SCHED_IDLE) && | ||
1875 | likely(p->policy != SCHED_IDLE)) | ||
1876 | goto preempt; | ||
1877 | |||
1873 | /* | 1878 | /* |
1874 | * Batch and idle tasks do not preempt (their preemption is driven by | 1879 | * Batch and idle tasks do not preempt non-idle tasks (their preemption |
1875 | * the tick): | 1880 | * is driven by the tick): |
1876 | */ | 1881 | */ |
1877 | if (unlikely(p->policy != SCHED_NORMAL)) | 1882 | if (unlikely(p->policy != SCHED_NORMAL)) |
1878 | return; | 1883 | return; |
1879 | 1884 | ||
1880 | /* Idle tasks are by definition preempted by everybody. */ | ||
1881 | if (unlikely(curr->policy == SCHED_IDLE)) | ||
1882 | goto preempt; | ||
1883 | 1885 | ||
1884 | if (!sched_feat(WAKEUP_PREEMPT)) | 1886 | if (!sched_feat(WAKEUP_PREEMPT)) |
1885 | return; | 1887 | return; |