Re: [patch] Real-Time Preemption, -RT-2.6.11-rc2-V0.7.37-02

From: Ingo Molnar
Date: Sat Feb 05 2005 - 03:03:06 EST



* Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> while(unlikely(error == IN_WAKEUP)) {
> cpu_relax();
> error = queue.status;
> }
>
> So, what looks to be happening is that as soon as the parent wakes up
> the child, the child preempts the parent, and hits this while loop.
> But since the child is a realtime task, with the highest priority of
> the system, it starves the system. Of course this is a UP and I don't
> think this will show a problem on an SMP machine.

hm - i had a fix in this area in the -V0.7 series. Then i thought this
is a performance fix only and dropped it eventually, but could you give
it a go - does it fix the deadlock?

Ingo

--- linux/ipc/sem.c.orig
+++ linux/ipc/sem.c
@@ -359,12 +371,18 @@ static void update_queue (struct sem_arr
struct sem_queue *n;
remove_from_queue(sma,q);
n = q->next;
+ /*
+ * Make sure that the wakeup doesnt preempt
+ * _this_ CPU prematurely. (on PREEMPT_RT)
+ */
+ preempt_disable();
q->status = IN_WAKEUP;
wake_up_process(q->sleeper);
/* hands-off: q will disappear immediately after
* writing q->status.
*/
q->status = error;
+ preempt_enable();
q = n;
} else {
q = q->next;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/