Re: tvtime and the Linux 2.6 scheduler

From: Ingo Molnar
Date: Mon May 24 2004 - 02:24:31 EST



* Billy Biggs <vektor@xxxxxxxxxxxx> wrote:

> for(;;)
> 9 ms : process frame
> 4 ms : draw frame
> 3 ms : wait until next field time using /dev/rtc
> 9 ms : process frame
> 4 ms : draw frame
> 3 ms : block on /dev/video0 for next frame
> -----
> 33 ms : time per NTSC frame
>
> The theory is that Linux classifies this as a CPU hog regardless of
> its priority, and preempts tvtime with other processes. [...]

this would indicate a pretty broken scheduler. To prove (or exclude)
this possibility, could you apply the attached debugging patch? The
patch checks whether we ever switch away from a still running (and
hence, on-runqueue) RT task to a non-RT task.

(NOTE: dont run this patch on an SMP kernel, the debugging message will
deadlock there due to spinlock recursion.)

Ingo

--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -2279,6 +2279,7 @@ switch_tasks:
prev->timestamp = now;

if (likely(prev != next)) {
+ WARN_ON(rt_task(prev) && (prev->state == TASK_RUNNING) && !rt_task(next));
next->timestamp = now;
rq->nr_switches++;
rq->curr = 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/