lkml.org 
[lkml]   [2012]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC][PATCH RT 2/4 v2] sched/rt: Try to migrate task if preempting pinned rt task
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);
}



\
 
 \ /
  Last update: 2012-12-12 21:01    [W:0.058 / U:0.888 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site