Re: bug in Real-Time Preemption

From: Michal Schmidt
Date: Fri Jun 10 2005 - 02:53:39 EST


Milan Svoboda wrote:
under non RT preempt:
(these results are expected)

./a.out
Flag: 0, Dif:11714
./a.out
Flag: 0, Dif:11678

under full RT preempt:
./a.out
Flag: 1, Dif:582536
./a.out
Flag: 1, Dif:579791

This shows that thread with bigger priority was
blocked by the thread with lower priority!

Can you retry with RT-V0.7.48-05 and this patch applied?

Michal diff -Nurp -X linux-RT/Documentation/dontdiff linux-RT/kernel/sched.c linux-RT.mich/kernel/sched.c
--- linux-RT/kernel/sched.c 2005-06-09 23:09:43.000000000 +0200
+++ linux-RT.mich/kernel/sched.c 2005-06-09 23:29:20.000000000 +0200
@@ -1190,18 +1190,14 @@ out_activate:
* this cpu. Delayed preemption is guaranteed to happen upon
* return to userspace.
*/
- if (cpu != this_cpu) {
+ if (!sync || cpu != this_cpu) {
activate_task(p, rq, cpu == this_cpu);
if (TASK_PREEMPTS_CURR(p, rq))
resched_task(rq->curr);
} else {
__activate_task(p, rq);
- if (TASK_PREEMPTS_CURR(p, rq)) {
- if (sync)
- set_tsk_need_resched_delayed(rq->curr);
- else
- resched_task(rq->curr);
- }
+ if (TASK_PREEMPTS_CURR(p, rq))
+ set_tsk_need_resched_delayed(rq->curr);
}
trace_start_sched_wakeup(p, rq);
if (rq->curr && p && rq && _need_resched())