1 diff -urN linux-2.4.20/include/linux/sched.h linux-2.4.20-interactive/include/linux/sched.h
2 --- linux-2.4.20/include/linux/sched.h Sun Mar 16 23:39:08 2003
3 +++ linux-2.4.20-interactive/include/linux/sched.h Sun Mar 16 23:40:18 2003
7 unsigned long sleep_avg;
8 - unsigned long sleep_timestamp;
9 + unsigned long last_run;
12 unsigned long cpus_allowed;
13 diff -urN linux-2.4.20/kernel/fork.c linux-2.4.20-interactive/kernel/fork.c
14 --- linux-2.4.20/kernel/fork.c Sun Mar 16 23:38:02 2003
15 +++ linux-2.4.20-interactive/kernel/fork.c Sun Mar 16 23:40:18 2003
17 current->time_slice = 1;
20 - p->sleep_timestamp = jiffies;
21 + p->last_run = jiffies;
25 diff -urN linux-2.4.20/kernel/sched.c linux-2.4.20-interactive/kernel/sched.c
26 --- linux-2.4.20/kernel/sched.c Sun Mar 16 23:38:57 2003
27 +++ linux-2.4.20-interactive/kernel/sched.c Sun Mar 16 23:40:18 2003
30 * These are the 'tuning knobs' of the scheduler:
32 - * Minimum timeslice is 10 msecs, default timeslice is 150 msecs,
33 - * maximum timeslice is 300 msecs. Timeslices get refilled after
34 + * Minimum timeslice is 10 msecs, default timeslice is 100 msecs,
35 + * maximum timeslice is 200 msecs. Timeslices get refilled after
38 #define MIN_TIMESLICE ( 10 * HZ / 1000)
39 -#define MAX_TIMESLICE (300 * HZ / 1000)
40 +#define MAX_TIMESLICE (200 * HZ / 1000)
41 #define CHILD_PENALTY 50
42 #define PARENT_PENALTY 100
43 #define PRIO_BONUS_RATIO 25
44 #define INTERACTIVE_DELTA 2
45 -#define MAX_SLEEP_AVG (2*HZ)
46 -#define STARVATION_LIMIT (2*HZ)
47 +#define MAX_SLEEP_AVG (10*HZ)
48 +#define STARVATION_LIMIT (10*HZ)
51 * If a task is 'interactive' then we reinsert it in the active
53 #define activate_task(p, rq) __activate_task(p, rq, NULL)
54 static inline void __activate_task(task_t *p, runqueue_t *rq, task_t * parent)
56 - unsigned long sleep_time = jiffies - p->sleep_timestamp;
57 - prio_array_t *array = rq->active;
58 + long sleep_time = jiffies - p->last_run - 1;
60 - if (!parent && !rt_task(p) && sleep_time) {
61 + if (!parent && !rt_task(p) && sleep_time > 0) {
63 * This code gives a bonus to interactive tasks. We update
64 * an 'average sleep time' value here, based on
65 - * sleep_timestamp. The more time a task spends sleeping,
66 + * ->last_run. The more time a task spends sleeping,
67 * the higher the average gets - and the higher the priority
70 - p->sleep_timestamp = jiffies;
71 + p->last_run = jiffies;
72 p->sleep_avg += sleep_time;
73 if (p->sleep_avg > MAX_SLEEP_AVG)
74 p->sleep_avg = MAX_SLEEP_AVG;
75 p->prio = effective_prio(p);
77 - __enqueue_task(p, array, parent);
78 + __enqueue_task(p, rq->active, parent);
84 if (old_state == TASK_UNINTERRUPTIBLE)
85 rq->nr_uninterruptible--;
86 - activate_task(p, rq);
87 - if (p->prio < rq->curr->prio)
88 - resched_task(rq->curr);
90 + enqueue_task(p, rq->active);
93 + activate_task(p, rq);
94 + if (p->prio < rq->curr->prio)
95 + resched_task(rq->curr);
99 p->state = TASK_RUNNING;
103 p->cpu = smp_processor_id();
104 - __activate_task(p, rq, parent);
105 + if (unlikely(!current->array)) {
106 + __enqueue_task(p, rq->active, parent);
109 + p->prio = current->prio;
110 + list_add_tail(&p->run_list, ¤t->run_list);
111 + p->array = current->array;
112 + p->array->nr_active++;
115 spin_unlock_irq(&rq->lock);
120 if (p->prio < this_rq->curr->prio)
123 + if (p->prio == this_rq->curr->prio &&
124 + p->time_slice > this_rq->curr->time_slice)
133 #define CAN_MIGRATE_TASK(p,rq,this_cpu) \
134 - ((jiffies - (p)->sleep_timestamp > cache_decay_ticks) && \
135 + ((jiffies - (p)->last_run > cache_decay_ticks) && \
136 ((p) != (rq)->curr) && \
137 ((p)->cpus_allowed & (1UL << (this_cpu))))
140 * increasing number of running tasks:
142 #define EXPIRED_STARVING(rq) \
143 - ((rq)->expired_timestamp && \
144 + (STARVATION_LIMIT && ((rq)->expired_timestamp && \
145 (jiffies - (rq)->expired_timestamp >= \
146 - STARVATION_LIMIT * ((rq)->nr_running) + 1))
147 + STARVATION_LIMIT * ((rq)->nr_running) + 1)))
150 * This function gets called by the timer code, with HZ frequency.
154 release_kernel_lock(prev, smp_processor_id());
155 - prev->sleep_timestamp = jiffies;
156 + prev->last_run = jiffies;
157 spin_lock_irq(&rq->lock);
159 switch (prev->state) {
160 @@ -1299,8 +1317,10 @@
161 p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority;
163 p->prio = p->static_prio;
165 - activate_task(p, task_rq(p));
167 + enqueue_task(p, task_rq(p)->active);
168 + task_rq(p)->nr_running++;
172 task_rq_unlock(rq, &flags);
173 diff -urN linux-2.4.20/kernel/softirq.c linux-2.4.20-interactive/kernel/softirq.c
174 --- linux-2.4.20/kernel/softirq.c Sun Mar 16 23:38:03 2003
175 +++ linux-2.4.20-interactive/kernel/softirq.c Sun Mar 16 23:40:18 2003
180 - __local_bh_enable();
183 wakeup_softirqd(cpu);
184 + __local_bh_enable();
187 local_irq_restore(flags);