On 04/18/2019 05:11 AM, Peter Zijlstra wrote:
> On Wed, Apr 17, 2019 at 01:51:24PM -0400, Waiman Long wrote:
>> On 04/17/2019 10:05 AM, Peter Zijlstra wrote:
>>> On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
@@ -650,6 +686,33 @@ __rwsem_down_read_failed_common(struct rw_semaphor
On 04/18/2019 04:57 AM, Peter Zijlstra wrote:
> On Wed, Apr 17, 2019 at 01:34:01PM -0400, Waiman Long wrote:
>> On 04/17/2019 09:56 AM, Peter Zijlstra wrote:
>>> On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
@@ -549,7 +582,7 @@ static noinline enum owner_state
rwsem_spin_o
On 04/18/2019 05:00 AM, Peter Zijlstra wrote:
> On Wed, Apr 17, 2019 at 01:45:10PM -0400, Waiman Long wrote:
>> On 04/17/2019 09:58 AM, Peter Zijlstra wrote:
>>> On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
+/*
+ * Try to acquire read lock before the reader is put on wait
On Wed, Apr 17, 2019 at 01:51:24PM -0400, Waiman Long wrote:
> On 04/17/2019 10:05 AM, Peter Zijlstra wrote:
> > On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
> >> @@ -650,6 +686,33 @@ __rwsem_down_read_failed_common(struct rw_semaphore
> >> *sem, int state)
> >>struct rwsem_wai
On Wed, Apr 17, 2019 at 01:45:10PM -0400, Waiman Long wrote:
> On 04/17/2019 09:58 AM, Peter Zijlstra wrote:
> > On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
> >> +/*
> >> + * Try to acquire read lock before the reader is put on wait queue.
> >> + * Lock acquisition isn't allowed if
On Wed, Apr 17, 2019 at 01:34:01PM -0400, Waiman Long wrote:
> On 04/17/2019 09:56 AM, Peter Zijlstra wrote:
> > On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
> >> @@ -549,7 +582,7 @@ static noinline enum owner_state
> >> rwsem_spin_on_owner(struct rw_semaphore *sem)
> >>return
On 04/17/2019 10:05 AM, Peter Zijlstra wrote:
> On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
>> @@ -650,6 +686,33 @@ __rwsem_down_read_failed_common(struct rw_semaphore
>> *sem, int state)
>> struct rwsem_waiter waiter;
>> DEFINE_WAKE_Q(wake_q);
>>
>> +if (!rwsem_ca
On 04/17/2019 09:58 AM, Peter Zijlstra wrote:
> On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
>> +/*
>> + * Try to acquire read lock before the reader is put on wait queue.
>> + * Lock acquisition isn't allowed if the rwsem is locked or a writer handoff
>> + * is ongoing.
>> + */
>>
On 04/17/2019 09:56 AM, Peter Zijlstra wrote:
> On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
>> @@ -549,7 +582,7 @@ static noinline enum owner_state
>> rwsem_spin_on_owner(struct rw_semaphore *sem)
>> return !owner ? OWNER_NULL : OWNER_READER;
>> }
>>
>> -static bool rwsem_
On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
> @@ -650,6 +686,33 @@ __rwsem_down_read_failed_common(struct rw_semaphore
> *sem, int state)
> struct rwsem_waiter waiter;
> DEFINE_WAKE_Q(wake_q);
>
> + if (!rwsem_can_spin_on_owner(sem))
> + goto queue;
>
On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
> +/*
> + * Try to acquire read lock before the reader is put on wait queue.
> + * Lock acquisition isn't allowed if the rwsem is locked or a writer handoff
> + * is ongoing.
> + */
> +static inline bool rwsem_try_read_lock_unqueued(struc
On Sat, Apr 13, 2019 at 01:22:54PM -0400, Waiman Long wrote:
> @@ -549,7 +582,7 @@ static noinline enum owner_state
> rwsem_spin_on_owner(struct rw_semaphore *sem)
> return !owner ? OWNER_NULL : OWNER_READER;
> }
>
> -static bool rwsem_optimistic_spin(struct rw_semaphore *sem)
> +static b
This patch enables readers to optimistically spin on a
rwsem when it is owned by a writer instead of going to sleep
directly. The rwsem_can_spin_on_owner() function is extracted
out of rwsem_optimistic_spin() and is called directly by
__rwsem_down_read_failed_common() and __rwsem_down_write_failed
13 matches
Mail list logo