On Mon, May 20, 2019 at 04:59:14PM -0400, Waiman Long wrote: > Reader optimistic spinning is helpful when the reader critical section > is short and there aren't that many readers around. It makes readers > relatively more preferred than writers. When a writer times out spinning > on a reader-owned lock and set the nospinnable bits, there are two main > reasons for that. > > 1) The reader critical section is long, perhaps the task sleeps after > acquiring the read lock. > 2) There are just too many readers contending the lock causing it to > take a while to service all of them. > > In the former case, long reader critical section will impede the progress > of writers which is usually more important for system performance. > In the later case, reader optimistic spinning tends to make the reader > groups that contain readers that acquire the lock together smaller > leading to more of them. That may hurt performance in some cases. In > other words, the setting of nonspinnable bits indicates that reader > optimistic spinning may not be helpful for those workloads that cause it. > > Therefore, any writers that have observed the setting of the writer > nonspinnable bit for a given rwsem after they fail to acquire the lock > via optimistic spinning will set the reader nonspinnable bit once they > acquire the write lock. Similarly, readers that observe the setting > of reader nonspinnable bit at slowpath entry will also set the reader > nonspinnable bit when they acquire the read lock via the wakeup path.
So both cases set the _reader_ nonspinnable bit?