RE: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-21 Thread David Laight
From: Davidlohr Bueso > Sent: 20 November 2020 21:38 > > On Fri, 20 Nov 2020, David Laight wrote: > >I got massive performance improvements from changing a driver > >we have to use mutex instead of the old semaphores (the driver > >was written a long time ago). > > > >While these weren't 'rw' the

Re: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-20 Thread Waiman Long
On 11/20/20 9:44 AM, Peter Zijlstra wrote: On Tue, Nov 17, 2020 at 09:35:56PM -0800, Davidlohr Bueso wrote: On Tue, 17 Nov 2020, Waiman Long wrote: The column "CS Load" represents the number of pause instructions issued in the locking critical section. A CS load of 1 is extremely short and is

Re: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-20 Thread Davidlohr Bueso
On Fri, 20 Nov 2020, David Laight wrote: I got massive performance improvements from changing a driver we have to use mutex instead of the old semaphores (the driver was written a long time ago). While these weren't 'rw' the same issue will apply. The problem was that the semaphore/mutex was

RE: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-20 Thread David Laight
From: Waiman Long > Sent: 20 November 2020 17:04 > > On 11/20/20 8:11 AM, David Laight wrote: > > From: Waiman Long > >> Sent: 19 November 2020 18:40 > > ... > >> My own testing also show not too much performance difference when > >> removing reader spinning except in the lightly loaded cases. >

Re: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-20 Thread Waiman Long
On 11/20/20 8:11 AM, David Laight wrote: From: Waiman Long Sent: 19 November 2020 18:40 ... My own testing also show not too much performance difference when removing reader spinning except in the lightly loaded cases. I'm confused. I got massive performance improvements from changing a

Re: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-20 Thread Peter Zijlstra
On Tue, Nov 17, 2020 at 09:35:56PM -0800, Davidlohr Bueso wrote: > On Tue, 17 Nov 2020, Waiman Long wrote: > > > The column "CS Load" represents the number of pause instructions issued > > in the locking critical section. A CS load of 1 is extremely short and > > is not likey in real situations.

Re: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-20 Thread Peter Zijlstra
On Tue, Nov 17, 2020 at 10:04:29PM -0500, Waiman Long wrote: > -static inline bool osq_is_empty(struct rw_semaphore *sem) > -{ > - return !osq_is_locked(>osq); > -static inline bool osq_is_empty(sem) > -{ > - return false; > -} Oh, it doesn't live...

RE: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-20 Thread David Laight
From: Waiman Long > Sent: 19 November 2020 18:40 ... > My own testing also show not too much performance difference when > removing reader spinning except in the lightly loaded cases. I'm confused. I got massive performance improvements from changing a driver we have to use mutex instead of the

Re: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-19 Thread Waiman Long
On 11/18/20 12:35 AM, Davidlohr Bueso wrote: On Tue, 17 Nov 2020, Waiman Long wrote: The column "CS Load" represents the number of pause instructions issued in the locking critical section. A CS load of 1 is extremely short and is not likey in real situations. A load of 20 (moderate) and 100

Re: [RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-17 Thread Davidlohr Bueso
On Tue, 17 Nov 2020, Waiman Long wrote: The column "CS Load" represents the number of pause instructions issued in the locking critical section. A CS load of 1 is extremely short and is not likey in real situations. A load of 20 (moderate) and 100 (long) are more realistic. It can be seen that

[RFC PATCH 5/5] locking/rwsem: Remove reader optimistic spinning

2020-11-17 Thread Waiman Long
Reader optimistic spinning is helpful when the reader critical section is short and there aren't that many readers around. It also improves the chance that a reader can get the lock as writer optimistic spinning disproportionally favors writers much more than readers. Since commit d3681e269fff