lkml.org 
[lkml]   [2020]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4/5] locking/rwsem: Wake up all waiting readers if RWSEM_WAKE_READ_OWNED
From
Date
On 11/17/20 11:53 PM, Davidlohr Bueso wrote:
> On Tue, 17 Nov 2020, Waiman Long wrote:
>
>> The rwsem wakeup logic has been modified by commit d3681e269fff
>> ("locking/rwsem: Wake up almost all readers in wait queue") to wake up
>> all readers in the wait queue if the first waiter is a reader. In the
>> case of RWSEM_WAKE_READ_OWNED, not all readers can be woken up if the
>> first waiter happens to be a writer. Complete the logic by waking up
>> all readers even for this case.
>
> While rwsems are certainly not fifo, I'm concerned this would give too
> much priority to the readers by having the reader owned lock just skip
> over the first waiter. And I'd say most users are more concerned about
> the writer side. Basically this would affect the phase-fair properties.

The idea of phase-fair is that when a reader acquires the lock, all the
current readers are allowed to join. Other readers that come after that
will not be allowed to join the read phase until the next round. In that
sense, waking up all readers in the wait queue doesn't violate this
fact. Patch 2 will guarantee  the later constraint though it has the
exception that if the reader count reach 0, it will allow reader to
proceed. I am relying on the handoff mechanism to make sure that there
will be no lock starvation.

Cheers,
Longman


\
 
 \ /
  Last update: 2020-11-19 19:39    [W:1.373 / U:1.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site