From 4c9612c6220a75ed202e9bce4a3246d89b4b11f0 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Thu, 16 Oct 2003 08:17:43 +0000 Subject: [PATCH] - The non iterative algorithm for interact_update was broken due to rounding errors. This was the source of the majority of the interactivity problems. Reintroduce the old algorithm and its XXX. - Up the interactivity threshold to 30. It really could stand to be even a tiny bit higher. - Let the sleep and run time accumulate up to 5 seconds of history rather than two. This helps stop XFree86 from becoming non-interactive during bursts of activity. --- sys/kern/sched_ule.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index c0e20446b7bb..1f6a4d0d3b56 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -150,11 +150,11 @@ struct td_sched *thread0_sched = &td_sched; * INTERACT_MAX: Maximum interactivity value. Smaller is better. * INTERACT_THRESH: Threshhold for placement on the current runq. */ -#define SCHED_SLP_RUN_MAX ((hz * 2) << 10) +#define SCHED_SLP_RUN_MAX ((hz * 5) << 10) #define SCHED_SLP_RUN_THROTTLE (100) #define SCHED_INTERACT_MAX (100) #define SCHED_INTERACT_HALF (SCHED_INTERACT_MAX / 2) -#define SCHED_INTERACT_THRESH (20) +#define SCHED_INTERACT_THRESH (30) /* * These parameters and macros determine the size of the time slice that is @@ -674,12 +674,10 @@ sched_slice(struct kse *ke) static void sched_interact_update(struct ksegrp *kg) { - int ratio; - if ((kg->kg_runtime + kg->kg_slptime) > SCHED_SLP_RUN_MAX) { - ratio = (SCHED_SLP_RUN_MAX / - (kg->kg_runtime + kg->kg_slptime)) * 4; - kg->kg_runtime = (kg->kg_runtime * ratio) / 5; - kg->kg_slptime = (kg->kg_slptime * ratio) / 5; + /* XXX Fixme, use a linear algorithm and not a while loop. */ + while ((kg->kg_runtime + kg->kg_slptime) > SCHED_SLP_RUN_MAX) { + kg->kg_runtime = (kg->kg_runtime / 5) * 4; + kg->kg_slptime = (kg->kg_slptime / 5) * 4; } }