lkml.org 
[lkml]   [2016]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH 3/3] locking/mutex: Add lock handoff to avoid starvation
    On Tue, Aug 23, 2016 at 03:47:53PM -0400, Waiman Long wrote:
    > On 08/23/2016 08:46 AM, Peter Zijlstra wrote:
    > >N
    > >@@ -573,8 +600,14 @@ __mutex_lock_common(struct mutex *lock,
    > > schedule_preempt_disabled();
    > > spin_lock_mutex(&lock->wait_lock, flags);
    > >
    > >+ if (__mutex_owner(lock) == current)
    > >+ break;
    > >+
    > > if (__mutex_trylock(lock))
    > > break;
    > >+
    > >+ if (__mutex_waiter_is_first(lock,&waiter))
    > >+ __mutex_set_flag(lock, MUTEX_FLAG_HANDOFF);
    > > }
    > > __set_task_state(task, TASK_RUNNING);
    > >
    > >
    >
    > You may want to think about doing some spinning while the owner is active
    > instead of going back to sleep again here.

    For sure; I just didn't bother pulling in your patches. I didn't want to
    sink in more time in case people really hated on 1/3 ;-)

    \
     
     \ /
      Last update: 2016-09-17 09:57    [W:4.102 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site