lkml.org 
[lkml]   [2015]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 7/7] sched/rt: reschedule if stop/dl task slip in after pull operations
Date
pull_rt_task() can drop (and re-acquire) rq->lock, this means a dl 
or stop task can slip in, in which case need to reschedule. This
patch add the reschedule when the scenario occurs.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
kernel/sched/rt.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 560d2fa..8c948bf 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2136,7 +2136,14 @@ static void switched_from_rt(struct rq *rq, struct task_struct *p)
if (!task_on_rq_queued(p) || rq->rt.rt_nr_running)
return;

- if (pull_rt_task(rq))
+ /*
+ * pull_rt_task() can drop (and re-acquire) rq->lock; this
+ * means a dl or stop task can slip in, in which case we need
+ * to reschedule.
+ */
+ if (pull_rt_task(rq) ||
+ (unlikely((rq->stop && task_on_rq_queued(rq->stop)) ||
+ rq->dl.dl_nr_running)))
resched_curr(rq);
}

@@ -2197,6 +2204,16 @@ prio_changed_rt(struct rq *rq, struct task_struct *p, int oldprio)
*/
if (oldprio < p->prio)
pull_rt_task(rq);
+
+ /*
+ * pull_rt_task() can drop (and re-acquire) rq->lock; this
+ * means a dl or stop task can slip in, in which case we need
+ * to reschedule.
+ */
+ if (unlikely((rq->stop && task_on_rq_queued(rq->stop)) ||
+ rq->dl.dl_nr_running))
+ resched_curr(rq);
+
/*
* If there's a higher priority task waiting to run
* then reschedule. Note, the above pull_rt_task
--
1.9.1


\
 
 \ /
  Last update: 2015-05-13 08:41    [W:0.162 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site