[RFC/PATCH 4/3] rt: PI-workqueue: fixup the barrier prio

From: Peter Zijlstra
Date: Mon Oct 22 2007 - 07:48:49 EST


small fix to the PI stuff,
we lost the prio of the barrier waiter.
---

Index: linux-2.6/kernel/workqueue.c
===================================================================
--- linux-2.6.orig/kernel/workqueue.c
+++ linux-2.6/kernel/workqueue.c
@@ -264,6 +264,7 @@ struct wq_full_barrier {
struct plist_head worklist;
struct wq_full_barrier *prev_barrier;
int prev_prio;
+ int waiter_prio;
struct cpu_workqueue_struct *cwq;
struct completion done;
};
@@ -291,6 +292,7 @@ again:
prio = work->entry.prio;
if (unlikely(worklist != &cwq->worklist)) {
prio = min(prio, cwq->barrier->prev_prio);
+ prio = min(prio, cwq->barrier->waiter_prio);
prio = min(prio, plist_first(&cwq->worklist)->prio);
}

@@ -393,14 +395,15 @@ static void wq_full_barrier_func(struct
struct wq_full_barrier *barrier =
container_of(work, struct wq_full_barrier, work);
struct cpu_workqueue_struct *cwq = barrier->cwq;
+ int prio = MAX_PRIO;

spin_lock_irq(&cwq->lock);
barrier->prev_barrier = cwq->barrier;
if (cwq->barrier) {
- barrier->prev_prio = min(cwq->barrier->prev_prio,
- plist_first(&cwq->barrier->worklist)->prio);
- } else
- barrier->prev_prio = MAX_PRIO;
+ prio = min(prio, cwq->barrier->waiter_prio);
+ prio = min(prio, plist_first(&cwq->barrier->worklist)->prio);
+ }
+ barrier->prev_prio = prio;
cwq->barrier = barrier;
spin_unlock_irq(&cwq->lock);
}
@@ -415,6 +418,7 @@ static void insert_wq_full_barrier(struc
plist_head_splice(&cwq->worklist, &barr->worklist);
barr->cwq = cwq;
init_completion(&barr->done);
+ barr->waiter_prio = current->normal_prio;

insert_work(cwq, &barr->work, 0, current->normal_prio, 1);
}

Attachment: signature.asc
Description: This is a digitally signed message part