Re: [PATCH-tip v3 05/14] locking/rwsem: Remove rwsem_wake() wakeup optimization

From: Waiman Long
Date: Thu Apr 11 2019 - 11:55:13 EST


On 04/11/2019 03:25 AM, Peter Zijlstra wrote:
> On Wed, Apr 10, 2019 at 02:42:22PM -0400, Waiman Long wrote:
>> With the commit 59aabfc7e959 ("locking/rwsem: Reduce spinlock contention
>> in wakeup after up_read()/up_write()"), the rwsem_wake() forgoes doing
>> a wakeup if the wait_lock cannot be directly acquired and an optimistic
>> spinning locker is present. This can help performance by avoiding
>> spinning on the wait_lock when it is contended.
>>
>> With the later commit 133e89ef5ef3 ("locking/rwsem: Enable lockless
>> waiter wakeup(s)"), the performance advantage of the above optimization
>> diminishes as the average wait_lock hold time become much shorter.
>>
>> By supporting rwsem lock handoff, we can no longer relies on the fact
>> that the presence of an optimistic spinning locker will ensure that the
>> lock will be acquired by a task soon. This can lead to missed wakeup
>> and application hang. So the commit 59aabfc7e959 ("locking/rwsem:
>> Reduce spinlock contention in wakeup after up_read()/up_write()")
>> will have to be reverted.
> Does it make sense to make this patch #3 in this series? The less code
> there is, the easier to review the other patches.

Yes, sure. I will move it up in the next version.

Cheers,
Longman