Re: must-fix list for 2.6.0

Mike Galbraith
2003-05-01T06:09:29Z

[-- Attachment #1: Type: text/plain, Size: 864 bytes --]

At 05:21 AM 5/1/2003 +0200, Mike Galbraith wrote:
>At 12:11 PM 4/30/2003 -0700, Andrew Morton wrote:
>>Maciej Soltysiak <solt@dns.toxicfilms.tv> wrote:
>> >
>> >
>> > Also there is one issue, i am not sure if this may be a kernel issue,
>> > but with setiathome running in a X desktop environment all apps work fine,
>> > but when i run openoffice, openoffice responds with 5 second delay.
>>
>>That'll be the changed sched_yield() semantics.
>>
>>The below patch should fix that up, but we need to decide whether the (rather
>>unclear) advantages of the sched_yield() change outweigh the breakage which
>>it caused linuxthreads applications.

<snip>

Anyway, attached is a patchlet that works for me if anyone wants to try
it. I removed printk's, and whatnot but it'll have some offsets because of
other butchery in my X-para-mental tree ;-)

-Mike

[-- Attachment #2: yield.diff --]
[-- Type: application/octet-stream, Size: 1541 bytes --]

--- kernel/sched.c.org Fri Apr 25 06:24:34 2003
+++ kernel/sched.c Thu May 1 07:38:00 2003
@@ -1265,7 +1323,7 @@
runqueue_t *rq;
prio_array_t *array;
struct list_head *queue;
- int idx;
+ int idx = 0;

/*
* Test if we are atomic. Since do_exit() needs to call into
@@ -1330,7 +1388,19 @@
rq->expired_timestamp = 0;
}

- idx = sched_find_first_bit(array->bitmap);
+ if (!idx || idx >= MAX_PRIO)
+ idx = sched_find_first_bit(array->bitmap);
+ else {
+ idx = find_next_bit(array->bitmap, MAX_PRIO, idx + 1);
+ if (idx >= MAX_PRIO) {
+ idx = 0;
+ spin_unlock_irq(&rq->lock);
+ reacquire_kernel_lock(current);
+ preempt_enable_no_resched();
+ goto need_resched;
+ }
+ }
+
queue = array->queue + idx;
next = list_entry(queue->next, task_t, run_list);

@@ -1984,19 +2054,12 @@
prio_array_t *array = current->array;

/*
- * We implement yielding by moving the task into the expired
- * queue.
- *
- * (special rule: RT tasks will just roundrobin in the active
- * array.)
+ * We implement yielding by moving the task to the back of
+ * the queue.
*/
- if (likely(!rt_task(current))) {
- dequeue_task(current, array);
- enqueue_task(current, rq->expired);
- } else {
- list_del(&current->run_list);
- list_add_tail(&current->run_list, array->queue + current->prio);
- }
+ list_del(&current->run_list);
+ list_add_tail(&current->run_list, array->queue + current->prio);
+ set_tsk_need_resched(current);
/*
* Since we are going to call schedule() anyway, there's
* no need to preempt: