Messages in this thread Patch in this message | | | From | Guillaume Chazarain <> | Date | Thu, 10 Jul 2003 09:14:57 +0200 | Subject | Re: [PATCH] Interactivity bits |
| |
Hello,
here is the latest version of my simple patch. I increased INTERACTIVE_DELTA to 4 as told me Mike Galbraith, he also explained to me why the p->state == TASK_INTERRUPTIBLE test was a bad thing.
The previous patch against -mm3 was an accident, it messed my tweaks with Con's work and it was... cough not tested...
I'd appreciate any feedback. Thanks.
Guillaume
--- linux-2.5.74-bk7/kernel/sched.c.old 2003-07-09 10:08:01.000000000 +0200 +++ linux-2.5.74-bk7/kernel/sched.c 2003-07-10 00:35:59.000000000 +0200 @@ -68,11 +68,11 @@ */ #define MIN_TIMESLICE ( 10 * HZ / 1000) #define MAX_TIMESLICE (200 * HZ / 1000) -#define CHILD_PENALTY 50 -#define PARENT_PENALTY 100 +#define CHILD_PENALTY 80 +#define PARENT_PENALTY 90 #define EXIT_WEIGHT 3 -#define PRIO_BONUS_RATIO 25 -#define INTERACTIVE_DELTA 2 +#define PRIO_BONUS_RATIO 45 +#define INTERACTIVE_DELTA 4 #define MAX_SLEEP_AVG (10*HZ) #define STARVATION_LIMIT (10*HZ) #define NODE_THRESHOLD 125 @@ -88,13 +88,13 @@ * We scale it linearly, offset by the INTERACTIVE_DELTA delta. * Here are a few examples of different nice levels: * - * TASK_INTERACTIVE(-20): [1,1,1,1,1,1,1,1,1,0,0] - * TASK_INTERACTIVE(-10): [1,1,1,1,1,1,1,0,0,0,0] - * TASK_INTERACTIVE( 0): [1,1,1,1,0,0,0,0,0,0,0] - * TASK_INTERACTIVE( 10): [1,1,0,0,0,0,0,0,0,0,0] - * TASK_INTERACTIVE( 19): [0,0,0,0,0,0,0,0,0,0,0] + * TASK_INTERACTIVE(-20): [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0] + * TASK_INTERACTIVE(-10): [1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0] + * TASK_INTERACTIVE( 0): [1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0] + * TASK_INTERACTIVE( 10): [1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + * TASK_INTERACTIVE( 19): [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] * - * (the X axis represents the possible -5 ... 0 ... +5 dynamic + * (the X axis represents the possible -9 ... 0 ... +9 dynamic * priority range a task can explore, a value of '1' means the * task is rated interactive.) * @@ -303,9 +303,9 @@ * priority but is modified by bonuses/penalties. * * We scale the actual sleep average [0 .... MAX_SLEEP_AVG] - * into the -5 ... 0 ... +5 bonus/penalty range. + * into the -9 ... 0 ... +9 bonus/penalty range. * - * We use 25% of the full 0...39 priority range so that: + * We use 50% of the full 0...39 priority range so that: * * 1) nice +19 interactive tasks do not preempt nice 0 CPU hogs. * 2) nice -20 CPU hogs do not get preempted by nice 0 tasks. @@ -347,9 +347,9 @@ */ static inline void activate_task(task_t *p, runqueue_t *rq) { - long sleep_time = jiffies - p->last_run - 1; + long sleep_time = jiffies - p->last_run; - if (sleep_time > 0) { + if (sleep_time) { int sleep_avg; /* @@ -361,15 +361,9 @@ * higher the priority boost gets as well. */ sleep_avg = p->sleep_avg + sleep_time; - - /* - * 'Overflow' bonus ticks go to the waker as well, so the - * ticks are not lost. This has the effect of further - * boosting tasks that are related to maximum-interactive - * tasks. - */ if (sleep_avg > MAX_SLEEP_AVG) sleep_avg = MAX_SLEEP_AVG; + if (p->sleep_avg != sleep_avg) { p->sleep_avg = sleep_avg; p->prio = effective_prio(p); [unhandled content-type:application/octet-stream] | |