Re: [Patch] task interactivity calculation (was Strangeinteractivity behaviour)

From: Mike Galbraith
Date: Tue Feb 28 2006 - 09:05:07 EST


On Tue, 2006-02-28 at 11:33 +0100, Martin Andersson wrote:
> The appended patch fixes the problem mentioned in
> http://lkml.org/lkml/2006/2/27/104
> regarding wrong truncations in the calculation of task interactivity
> when the nice value is negative. The problem causes the interactivity to
> scale nonlinearly and differ from examples in the code.
>

Hi (again) Martin,

Patches are required to have a credit/blame line these days ala...

Signed-off-by: Martin Andersson <martin.andersson@xxxxxxxxxxxxxx>

...and should be sent with a cc to the subsystem maintainer In this
case, Ingo Molnar. Things tend to go into mainline through Andrew
Morton after being acked, so I've taken the liberty of adding him as
well.

Wrt the fix itself, rather than scrunch to fit 80 columns, I'd just...

#define DELTA(p) \
(SCALE(TASK_NICE(p) + 20, 40, MAX_BONUS) - 20 * MAX_BONUS / 40 + \
INTERACTIVE_DELTA)

...wrap at the nearest readable spot.

(hmm. just re-packaging the thing would have wasted fewer electrons;)

-Mike

> /Martin Andersson
>
> diff -uprN linux-2.6.15.4.orig/kernel/sched.c linux-2.6.15.4/kernel/sched.c
> --- linux-2.6.15.4.orig/kernel/sched.c 2006-02-10 08:22:48.000000000 +0100
> +++ linux-2.6.15.4/kernel/sched.c 2006-02-28 11:10:30.000000000 +0100
> @@ -142,7 +142,7 @@
> (v1) * (v2_max) / (v1_max)
>
> #define DELTA(p) \
> - (SCALE(TASK_NICE(p), 40, MAX_BONUS) + INTERACTIVE_DELTA)
> + (SCALE(TASK_NICE(p)+20,40, MAX_BONUS)-20*MAX_BONUS/40+INTERACTIVE_DELTA)
>
> #define TASK_INTERACTIVE(p) \
> ((p)->prio <= (p)->static_prio - DELTA(p))
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

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