lkml.org 
[lkml]   [2016]   [Feb]   [13]   [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 02:14:44PM -0800, Davidlohr Bueso wrote:
> On Fri, 12 Feb 2016, Peter Zijlstra wrote:
>
> >On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote:
> >> static bool mutex_optimistic_spin(struct mutex *lock,
> >>+ struct ww_acquire_ctx *ww_ctx,
> >>+ const bool use_ww_ctx, int waiter)
> >> {
> >> struct task_struct *task = current;
> >>+ bool acquired = false;
> >>
> >>+ if (!waiter) {
> >>+ if (!mutex_can_spin_on_owner(lock))
> >>+ goto done;
> >
> >Why doesn't the waiter have to check mutex_can_spin_on_owner() ?
>
> afaict because mutex_can_spin_on_owner() fails immediately when the counter
> is -1, which is a nono for the waiters case.

Can't see it do that, also, if it were to do that, we'd not be here
since having a waiter would then mean no spinners and no starvation
etc..

\
 
 \ /
  Last update: 2016-02-13 13:41    [W:0.084 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site