sched: fix regression with sched yield
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Mon, 18 Feb 2008 12:39:37 +0000 (13:39 +0100)
committerIngo Molnar <mingo@elte.hu>
Sat, 19 Apr 2008 17:44:57 +0000 (19:44 +0200)
Balbir Singh reported:

> 1:mon> t
> [c0000000e7677da0c000000000067de0 .sys_sched_yield+0x6c/0xbc
> [c0000000e7677e30c000000000008748 syscall_exit+0x0/0x40
> --- Exception: c01 (System Call) at 00000400001d09e4
> SP (4000664cb10) is in userspace
> 1:mon> r
> cpu 0x1: Vector: 300 (Data Access) at [c0000000e7677aa0]
>     pc: c000000000068e50: .yield_task_fair+0x94/0xc4
>     lr: c000000000067de0: .sys_sched_yield+0x6c/0xbc

the check that should have avoided that is:

        /*
         * Are we the only task in the tree?
         */
        if (unlikely(rq->load.weight == curr->se.load.weight))
                return;

But I guess that overlooks rt tasks, they also increase the load.
So I guess something like this ought to fix it..

Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched_fair.c

index bedda18f37a5708b58f8eacc9d9d4043d9be889e..290cf770b71252675b4756a8e5af15f10d1939fa 100644 (file)
@@ -904,7 +904,7 @@ static void yield_task_fair(struct rq *rq)
        /*
         * Already in the rightmost position?
         */
-       if (unlikely(rightmost->vruntime < se->vruntime))
+       if (unlikely(!rightmost || rightmost->vruntime < se->vruntime))
                return;
 
        /*