low-latency patch bug?

From: anton wilson (anton.wilson@camotion.com)
Date: Tue Jul 02 2002 - 09:40:20 EST


I think I found a bug in the low latency patch. In reschedule_idle there is
code that it adds that looks like this:

/*1*/#if LOWLATENCY_NEEDED
/*2*/ if (enable_lowlatency && (p->policy != SCHED_OTHER)) {
/*3*/ struct task_struct *t;
/*4*/ for (i = 0; i < smp_num_cpus; i++) {
/*5*/ cpu = cpu_logical_map(i);
/*6*/ t = cpu_curr(cpu);
/*7*/ if (t != tsk) //<------BUG
/*8*/ t->need_resched = 1;
/*9*/ }
/*10*/ }
/*11*/#endif

This code does not check to see if tsk (target_tsk) is NULL at line 7.
Therefore, the scheduler will try to reschedule even if tsk == NULL. In the
worst case, if your process selection loop finds a different process to run
everytime, and tsk is always NULL, the scheduler will enter an infinite loop.

I ran into this problem because I was pushing SCHED_RR tasks with the same
priority to the back of the runqueue everytime the scheduler was called.
Therefore a new process is found everytime and __schedule_tail is called
everytime, and therefore a infinite loop.

Anton Wilson

-- 
Camotion
Software Development
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jul 07 2002 - 22:00:09 EST