Is a process with a priority of 0 legal ?

From: DJBARROW@de.ibm.com
Date: Thu Sep 07 2000 - 09:56:22 EST


If it is the 2.2.16 scheduler & other linux'es have a bug.

The following code snippets can go into a tight loop.
while (p != &init_task)
{
     if (can_schedule(p))
     {
          int weight = goodness(prev, p, this_cpu);
          if (weight > c)
               c = weight, next = p;
     }
     p = p->next_run;
}

/* Do we need to re-calculate counters? */
if (!c)
     goto recalculate;

recalculate:
{
     struct task_struct *p;
     spin_unlock_irq(&runqueue_lock);
     read_lock(&tasklist_lock);
     for_each_task(p)
          p->counter = (p->counter >> 1) + p->priority;
     read_unlock(&tasklist_lock);
     spin_lock_irq(&runqueue_lock);
     goto repeat_schedule;
}

If the weight & priority of all runnable processes is 0 then the
recalculate with recalculate p->counter=0 for all runnable processes,
& the code will go into a tight loop between the goodness calculation &
recalculate.

Not very robust in my opinion.

D.J. Barrow Linux for S/390 kernel developer
eMail: djbarrow@de.ibm.com,barrow_dj@yahoo.com
Phone: +49-(0)7031-16-2583
IBM Germany Lab, Schönaicherstr. 220, 71032 Böblingen

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



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:30 EST