lkml.org 
[lkml]   [2008]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patches in this message
    /
    Date
    From
    SubjectRe: [git pull] scheduler fixes

    * Matthew Wilcox <matthew@wil.cx> wrote:

    > So I deem my fix "proven by thought experiment". I haven't tried
    > booting it or anything.

    i actually have two fixes, made earlier today. The 'fix3' one has been
    confirmed by Sven to fix the regression - but i think we need the 'fix
    #2' one below as well to make it complete.

    Ingo

    -------------------->
    Subject: semaphore: fix3
    From: Ingo Molnar <mingo@elte.hu>
    Date: Sun May 11 09:51:07 CEST 2008

    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    ---
    kernel/semaphore.c | 7 +++++++
    1 file changed, 7 insertions(+)

    Index: linux/kernel/semaphore.c
    ===================================================================
    --- linux.orig/kernel/semaphore.c
    +++ linux/kernel/semaphore.c
    @@ -258,5 +258,12 @@ static noinline void __sched __up(struct
    {
    struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
    struct semaphore_waiter, list);
    +
    + /*
    + * Rotate sleepers - to make sure all of them get woken in case
    + * of parallel up()s:
    + */
    + list_move_tail(&waiter->list, &sem->wait_list);
    +
    wake_up_process(waiter->task);
    }
    ---------------->
    Subject: semaphore: fix #2
    From: Ingo Molnar <mingo@elte.hu>
    Date: Thu May 08 11:53:48 CEST 2008
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    ---
    kernel/semaphore.c | 16 ++++++++++------
    1 file changed, 10 insertions(+), 6 deletions(-)
    Index: linux/kernel/semaphore.c
    ===================================================================
    --- linux.orig/kernel/semaphore.c
    +++ linux/kernel/semaphore.c
    @@ -194,6 +194,13 @@ struct semaphore_waiter {
    struct task_struct *task;
    };

    +static noinline void __sched __up(struct semaphore *sem)
    +{
    + struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
    + struct semaphore_waiter, list);
    + wake_up_process(waiter->task);
    +}
    +
    /*
    * Because this function is inlined, the 'state' parameter will be
    * constant, and thus optimised away by the compiler. Likewise the
    @@ -231,6 +238,9 @@ static inline int __sched __down_common(
    }

    list_del(&waiter.list);
    + if (unlikely(!list_empty(&sem->wait_list)) && sem->count)
    + __up(sem);
    +
    return ret;
    }

    @@ -254,9 +264,3 @@ static noinline int __sched __down_timeo
    return __down_common(sem, TASK_UNINTERRUPTIBLE, jiffies);
    }

    -static noinline void __sched __up(struct semaphore *sem)
    -{
    - struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
    - struct semaphore_waiter, list);
    - wake_up_process(waiter->task);
    -}

    \
     
     \ /
      Last update: 2008-05-11 14:53    [W:2.631 / U:0.396 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site