From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Carsten Emde <C.Emde@osadl.org>, John Kacur <jkacur@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Clark Williams <clark.williams@gmail.com>,
Ingo Molnar <mingo@kernel.org>,
Frank Rowand <frank.rowand@am.sony.com>,
Mike Galbraith <bitbucket@online.de>
Subject: [RFC][PATCH RT 2/4 v2] sched/rt: Try to migrate task if preempting pinned rt task
Date: Wed, 12 Dec 2012 14:27:35 -0500 [thread overview]
Message-ID: <20121212193920.529719829@goodmis.org> (raw)
In-Reply-To: 20121212192733.221810086@goodmis.org
[-- Attachment #1: fix-post-sched-push.patch --]
[-- Type: text/plain, Size: 1545 bytes --]
If a higher priority task is about to preempt a task that has been
pinned to a CPU. Try to first see if the higher priority task can
preempt another task instead.
That is, a high priority process wakes up on a CPU while a currently
running task can still migrate, it will miss pushing that high priority
task to another CPU. If by the time the task schedules, the task
that it's about to preempt could have changed its affinity and
is pinned. At this time, it may be better to move the task to another
CPU if one exists that is currently running a lower priority task
than the one about to be preempted.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Index: linux-rt.git/kernel/sched/rt.c
===================================================================
--- linux-rt.git.orig/kernel/sched/rt.c
+++ linux-rt.git/kernel/sched/rt.c
@@ -1804,8 +1804,22 @@ skip:
static void pre_schedule_rt(struct rq *rq, struct task_struct *prev)
{
+ struct task_struct *p = prev;
+
+ /*
+ * If we are preempting a pinned task see if we can push
+ * the higher priority task first.
+ */
+ if (prev->on_rq && (prev->nr_cpus_allowed <= 1 || prev->migrate_disable) &&
+ has_pushable_tasks(rq) && rq->rt.highest_prio.next < prev->prio) {
+ p = _pick_next_task_rt(rq);
+
+ if (p != prev && p->nr_cpus_allowed > 1 && push_rt_task(rq))
+ p = _pick_next_task_rt(rq);
+ }
+
/* Try to pull RT tasks here if we lower this rq's prio */
- if (rq->rt.highest_prio.curr > prev->prio)
+ if (rq->rt.highest_prio.curr > p->prio)
pull_rt_task(rq);
}
next prev parent reply other threads:[~2012-12-12 19:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-12 19:27 [RFC][PATCH RT 0/4 v2] sched/rt: Lower rq lock contention latencies on many CPU boxes Steven Rostedt
2012-12-12 19:27 ` [RFC][PATCH RT 1/4 v2] sched/rt: Fix push_rt_task() to have the same checks as the caller did Steven Rostedt
2012-12-12 19:27 ` Steven Rostedt [this message]
2012-12-12 19:27 ` [RFC][PATCH RT 3/4 v2] sched/rt: Initiate a pull when the priority of a task is lowered Steven Rostedt
2012-12-12 19:27 ` [RFC][PATCH RT 4/4 v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling Steven Rostedt
2012-12-12 20:44 ` Steven Rostedt
2012-12-13 19:53 ` Steven Rostedt
2012-12-21 15:42 ` Mike Galbraith
2013-02-13 16:49 ` John Kacur
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=20121212193920.529719829@goodmis.org \
--to=rostedt@goodmis.org \
--cc=C.Emde@osadl.org \
--cc=bitbucket@online.de \
--cc=clark.williams@gmail.com \
--cc=frank.rowand@am.sony.com \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).