2002-07-02 14:27:35

by anton wilson

[permalink] [raw]
Subject: low-latency patch bug?


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