Re: [patch] Re: scheduling priorities

Neil Conway (nconway.list@ukaea.org.uk)
Fri, 15 Jan 1999 15:02:40 +0000


MOLNAR Ingo wrote:
>
> On Fri, 15 Jan 1999, Gabriel Paubert wrote:
>
> > It furiously looks like an off by one error (or an < versus <=
> > comparison, or a postfix versus prefix increment or decrement)
> > which would give actually 2 and 21 slices rather than 1 and 20:
> >
> > 2/23 ~= 8.7 %
> > 21/23 ~= 91.3 %
>
> yes, the reason is that we do not reschedule when we reach
> current->counter == 0, but only when current->counter <= 0:
>
> p->counter -= ticks;
> if (p->counter < 0) {
> p->counter = 0;
> p->need_resched = 1;

Thanks to you and Max for pointing this out to me.

This being the case, then rather than patching the kernel to say "210ms
timeslices" (it's ~201ms on Alpha anyway) we should simply do "if
(p->counter <= 0)" instead (and change the SMP case to be "if
(p->counter > 0)" instead of ">= 0"), then we have 200ms timeslices.

This isn't purely cosmetic: 5% IS a little better as minimum CPU usage
than 9%, let's face it.

Neil

-
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/