lkml.org 
[lkml]   [2011]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: Bug in scheduler when using rt_mutex
From
Date
On Mon, 2011-01-17 at 16:42 +0200, Onkalo Samu wrote:
>
> Failure case:
> - user process locks rt_mutex
> - and goes to sleep (wait_for_completion etc.)
> - user process is dequeued to sleep state
> -> vruntime is not updated in dequeue_entity
>

Does the below (completely untested) patch help?

---
kernel/sched.c | 6 +++++-
kernel/sched_fair.c | 11 +++++++++++
2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index a0eb094..be09581 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8108,8 +8108,10 @@ EXPORT_SYMBOL(__might_sleep);
#ifdef CONFIG_MAGIC_SYSRQ
static void normalize_task(struct rq *rq, struct task_struct *p)
{
+ struct sched_class *prev_class = p->sched_class;
+ int old_prio = p->prio;
int on_rq;
-
+
on_rq = p->se.on_rq;
if (on_rq)
deactivate_task(rq, p, 0);
@@ -8118,6 +8120,8 @@ static void normalize_task(struct rq *rq, struct task_struct *p)
activate_task(rq, p, 0);
resched_task(rq->curr);
}
+
+ check_class_changed(rq, p, prev_class, old_prio, task_current(rq, p));
}

void normalize_rt_tasks(void)
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c62ebae..0a27b00 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -4072,6 +4072,17 @@ static void prio_changed_fair(struct rq *rq, struct task_struct *p,
static void switched_to_fair(struct rq *rq, struct task_struct *p,
int running)
{
+ struct sched_entity *se = &p->se;
+ struct cfs_rq *cfs_rq = cfs_rq_of(se);
+
+ if (se->on_rq && cfs_rq->curr != se)
+ __dequeue_entity(cfs_rq, se);
+
+ place_entity(cfs_rq, se, 0);
+
+ if (se->on_rq && cfs_rq->curr != se)
+ __enqueue_entity(cfs_rq, se);
+
/*
* We were most likely switched from sched_rt, so
* kick off the schedule if running, otherwise just see


\
 
 \ /
  Last update: 2011-01-17 17:03    [W:0.107 / U:75.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site