--=_courier-13716-1057821258-0001-2
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 7bit
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);
--=_courier-13716-1057821258-0001-2
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="patch.-mm3"
LS0tIGxpbnV4LTIuNS43NC1tbTMva2VybmVsL3NjaGVkLmMub2xkCTIwMDMt
MDctMDkgMTY6NDQ6MzEuMDAwMDAwMDAwICswMjAwCisrKyBsaW51eC0yLj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