Skip to contentSkip to conversation

RT: Fix a bug for properly setting the priority on rt-dequeue

PATCH New Gregory Haskins 1 participant 1 message Nov 14, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RT: Fix a bug for properly setting the priority on rt-dequeue

Hi Steven,
This patch applies to 23-rt11 to fix that bug you found in the git-HEAD merge. I will fold this patch into my 24 series so it is fixed there. Feel free to fold this into patch "#8" instead of maintaining it seperately, if you prefer.

--------------------------

RT: Fix a bug for properly setting the priority on rt-dequeue

We need to update the priority on task-dequeue whenever it changes, not just if more RT tasks are pending.

---

 kernel/sched_rt.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
kernel/sched_rt.c +5 -1
index f05912a..864d18a 100644
@@ -85,6 +85,8 @@ static inline void inc_rt_tasks(struct task_struct *p, struct rq *rq)
 
 static inline void dec_rt_tasks(struct task_struct *p, struct rq *rq)
 {
+	int highest_prio = rq->rt.highest_prio;
+
 	WARN_ON(!rt_task(p));
 	WARN_ON(!rq->rt.rt_nr_running);
 	rq->rt.rt_nr_running--;
@@ -98,13 +100,15 @@ static inline void dec_rt_tasks(struct task_struct *p, struct rq *rq)
 			array = &rq->rt.active;
 			rq->rt.highest_prio =
 				sched_find_first_bit(array->bitmap);
-			cpupri_set(rq->cpu, rq->rt.highest_prio);
 		} /* otherwise leave rq->highest prio alone */
 	} else
 		rq->rt.highest_prio = MAX_RT_PRIO;
 	if (p->nr_cpus_allowed > 1)
 		rq->rt.rt_nr_migratory--;
 
+	if (rq->rt.highest_prio != highest_prio)
+		cpupri_set(rq->cpu, rq->rt.highest_prio);
+
 	update_rt_migration(p, rq);
 #endif /* CONFIG_SMP */
 }