Re: Tiny patch: nice 20 as idle priority

Pavel Machek (pavel@atrey.karlin.mff.cuni.cz)
Mon, 19 Oct 1998 14:03:06 +0200


Hi!

> After we looked at some alternative schedulers for the linux kernel
> (the QNX-like scheduler, the sched_idle patch at Linux-MAMA)
> a friend of mine (Marco Bodrato <bodrato@linuz.sns.it> )
> wrote a tiny patch that allows nice 20 tasks, which get executed only when
> the kernel has no other (normal or real-time priority) tasks to run.
>
> As I said, the patch is really small, so I attach it directly to this e-mail.
> If someone is interested in it and/or gives a feedback, he's
> welcome.

It looks nicely, still...

> @@ -283,6 +285,9 @@
> weight += 1;
> }
>
> + if (!p->priority)
> + weight -= 999;
> +
> return weight;
> }

=> weight is likely to be small but probably _not_ -999

> @@ -457,9 +462,10 @@
> }
>
> /* if all runnable processes have "counter == 0", re-calculate counters */
> - if (!c) {
> + if (!c || c==-999) {

So you should not test if it is _exactly_ -999.

Not sure I see bug. I may.

Pavel

-- 
The best software in life is free (not shareware)!		Pavel
GCM d? s-: !g p?:+ au- a--@ w+ v- C++@ UL+++ L++ N++ E++ W--- M- Y- R+

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