From: tip-bot for Darren Hart <dvhart@linux.intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, dvhart@linux.intel.com, efault@gmx.de,
richard.purdie@linuxfoundation.org, tglx@linutronix.de,
mingo@elte.hu
Subject: [tip:sched/core] sched: Allow SCHED_BATCH to preempt SCHED_IDLE tasks
Date: Fri, 4 Mar 2011 11:49:24 GMT [thread overview]
Message-ID: <tip-a2f5c9ab79f78e8b91ac993e0543d65b661dd19b@git.kernel.org> (raw)
In-Reply-To: <1298408674-3130-2-git-send-email-dvhart@linux.intel.com>
Commit-ID: a2f5c9ab79f78e8b91ac993e0543d65b661dd19b
Gitweb: http://git.kernel.org/tip/a2f5c9ab79f78e8b91ac993e0543d65b661dd19b
Author: Darren Hart <dvhart@linux.intel.com>
AuthorDate: Tue, 22 Feb 2011 13:04:33 -0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Mar 2011 11:14:29 +0100
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>
---
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 3a88dee..1438e13 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_
if (test_tsk_need_resched(curr))
return;
+ /* Idle tasks are by definition preempted by non-idle tasks. */
+ if (unlikely(curr->policy == SCHED_IDLE) &&
+ likely(p->policy != SCHED_IDLE))
+ goto preempt;
+
/*
- * Batch and idle tasks do not preempt (their preemption is driven by
- * the tick):
+ * Batch and idle tasks do not preempt non-idle tasks (their preemption
+ * is driven by the tick):
*/
if (unlikely(p->policy != SCHED_NORMAL))
return;
- /* Idle tasks are by definition preempted by everybody. */
- if (unlikely(curr->policy == SCHED_IDLE))
- goto preempt;
if (!sched_feat(WAKEUP_PREEMPT))
return;
next prev parent reply other threads:[~2011-03-04 11:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 21:04 [PATCH 0/2] sched: SCHED_BATCH fixes Darren Hart
2011-02-22 21:04 ` [PATCH 1/2] sched: allow SCHED_BATCH to preempt SCHED_IDLE tasks Darren Hart
2011-02-23 4:20 ` Mike Galbraith
2011-02-23 5:31 ` Mike Galbraith
2011-02-23 5:33 ` Darren Hart
2011-03-04 11:49 ` tip-bot for Darren Hart [this message]
2011-02-22 21:04 ` [PATCH 2/2] sched: allow users with rtprio rlimit to change from SCHED_IDLE policy Darren Hart
2011-02-23 11:03 ` Peter Zijlstra
2011-02-23 11:13 ` Ingo Molnar
2011-02-23 11:17 ` Peter Zijlstra
2011-02-23 11:35 ` Ingo Molnar
2011-02-23 15:52 ` Darren Hart
2011-02-23 16:00 ` Peter Zijlstra
2011-02-23 16:07 ` Darren Hart
2011-02-23 21:28 ` Darren Hart
2011-02-24 11:49 ` Peter Zijlstra
2011-03-04 11:49 ` [tip:sched/core] sched: Allow users with sufficient RLIMIT_NICE " tip-bot for Darren Hart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-a2f5c9ab79f78e8b91ac993e0543d65b661dd19b@git.kernel.org \
--to=dvhart@linux.intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=richard.purdie@linuxfoundation.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome