Re: [RFC PATCH-tip v2 3/6] locking/rwsem: Enable count-based spinning on reader

2016-06-15 Thread Waiman Long
On 06/15/2016 01:38 PM, Peter Zijlstra wrote: On Tue, Jun 14, 2016 at 06:48:06PM -0400, Waiman Long wrote: static bool rwsem_optimistic_spin(struct rw_semaphore *sem) { - bool taken = false; + bool taken = false, can_spin; I would place the variables without assignment first.

Re: [RFC PATCH-tip v2 3/6] locking/rwsem: Enable count-based spinning on reader

2016-06-15 Thread Peter Zijlstra
On Tue, Jun 14, 2016 at 06:48:06PM -0400, Waiman Long wrote: > static bool rwsem_optimistic_spin(struct rw_semaphore *sem) > { > - bool taken = false; > + bool taken = false, can_spin; I would place the variables without assignment first. > + int loopcnt; > > preempt_disable

[RFC PATCH-tip v2 3/6] locking/rwsem: Enable count-based spinning on reader

2016-06-14 Thread Waiman Long
When the rwsem is owned by reader, writers stop optimistic spinning simply because there is no easy way to figure out if all the readers are actively running or not. However, there are scenarios where the readers are unlikely to sleep and optimistic spinning can help performance. This patch provid