Re: [PATCH v3 2/2] locking: Implement an algorithm choice for Wound-Wait mutexes

2018-06-18 Thread Thomas Hellstrom
On 06/15/2018 06:46 PM, Peter Zijlstra wrote: On Fri, Jun 15, 2018 at 02:08:27PM +0200, Thomas Hellstrom wrote: @@ -772,6 +856,25 @@ __ww_mutex_add_waiter(struct mutex_waiter *waiter, } list_add_tail(&waiter->list, pos); + if (__mutex_waiter_is_first(lock, waiter)) +

Re: [PATCH v3 2/2] locking: Implement an algorithm choice for Wound-Wait mutexes

2018-06-15 Thread Peter Zijlstra
On Fri, Jun 15, 2018 at 02:08:27PM +0200, Thomas Hellstrom wrote: > @@ -772,6 +856,25 @@ __ww_mutex_add_waiter(struct mutex_waiter *waiter, > } > > list_add_tail(&waiter->list, pos); > + if (__mutex_waiter_is_first(lock, waiter)) > + __mutex_set_flag(lock, MUTEX_FLAG_

[PATCH v3 2/2] locking: Implement an algorithm choice for Wound-Wait mutexes

2018-06-15 Thread Thomas Hellstrom
The current Wound-Wait mutex algorithm is actually not Wound-Wait but Wait-Die. Implement also Wound-Wait as a per-ww-class choice. Wound-Wait is, contrary to Wait-Die a preemptive algorithm and is known to generate fewer backoffs. Testing reveals that this is true if the number of simultaneous con