lkml.org 
[lkml]   [2016]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()
On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote:
> @@ -358,8 +373,8 @@ static bool mutex_optimistic_spin(struct mutex *lock,
> }
>
> mutex_set_owner(lock);
> - osq_unlock(&lock->osq);
> - return true;
> + acquired = true;
> + break;
> }
>
> /*
> @@ -380,7 +395,10 @@ static bool mutex_optimistic_spin(struct mutex *lock,
> cpu_relax_lowlatency();
> }
>
> - osq_unlock(&lock->osq);
> + if (!waiter)
> + osq_unlock(&lock->osq);
> + if (acquired || waiter)
> + return acquired;
> done:
> /*
> * If we fell out of the spin path because of need_resched(),

Is there a reason to not also preempt in the wait-loop? Surely the same
reason is still valid there too?

\
 
 \ /
  Last update: 2016-02-12 22:01    [W:0.138 / U:0.804 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site