Re: idle_task priority and scheduling 2.1.131

Rik van Riel (H.H.vanRiel@phys.uu.nl)
Fri, 4 Dec 1998 10:56:17 +0100 (CET)


On Fri, 4 Dec 1998, Andrea Arcangeli wrote:
> On Thu, 3 Dec 1998, Rik van Riel wrote:
>
> >Move the != SCHED_OTHER test before the goodness test,
> >it will avoid clobbering p->policy, fouling up the
> >actual reschedule.

> - if (p->policy != SCHED_OTHER || p->counter > current->counter + 3)
> - current->need_resched = 1;
> + if (p->policy != SCHED_OTHER ||

Please change this to:
if (p->policy != SCHED_OTHER || current->policy != SCHED_OTHER ||

> + p->counter + p->priority > this->counter + this->priority + 3)
> + current->need_resched = 1;
> }

We really want to catch the case where current has set
SCHED_YIELD or has done something strange (idle process).

We can safely use this test because the number of tasks
where policy != SCHED_OTHER should be relatively small
so only testing this should be cheaper than an expensive
test followed by a (very rare) wasted schedule().

regards,

Rik -- the flu hits, the flu hits, the flu hits -- MORE
+-------------------------------------------------------------------+
| Linux memory management tour guide. H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader. http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+

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