lkml.org 
[lkml]   [2013]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] sched:rt: don't try to pull a running task
Date
If we happen to pull a running task on other cpu, a WARNING
will happen. But the very task will be pulled to this cpu
finally. This pulling is dangerous since the task's private
data could be broken. Fix it by skipping this kind of task.

Signed-off-by: Yong Zhang <yong.zhang@windriver.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
kernel/sched/rt.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 01970c8..e76d278 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1665,7 +1665,15 @@ static int pull_rt_task(struct rq *this_rq)
* the to-be-scheduled task?
*/
if (p && (p->prio < this_rq->rt.highest_prio.curr)) {
- WARN_ON(p == src_rq->curr);
+ /*
+ * if we happen to choose a running task on other
+ * cpu, skip it and find another one.
+ */
+ if (unlikely(p == src_rq->curr)) {
+ WARN_ON_ONCE(1);
+ goto skip;
+ }
+
WARN_ON(!p->on_rq);

/*
--
1.7.9.5


\
 
 \ /
  Last update: 2013-09-30 10:21    [W:0.027 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site