Re: [PATCH-tip v7 01/20] locking/rwsem: Prevent decrement of reader count before increment

2019-05-03 Thread Waiman Long
On 5/3/19 8:06 AM, Peter Zijlstra wrote: > On Sun, Apr 28, 2019 at 05:25:38PM -0400, Waiman Long wrote: >> During my rwsem testing, it was found that after a down_read(), the >> reader count may occasionally become 0 or even negative. Consequently, >> a writer may steal the lock at that time and ex

Re: [PATCH-tip v7 01/20] locking/rwsem: Prevent decrement of reader count before increment

2019-05-03 Thread Peter Zijlstra
On Sun, Apr 28, 2019 at 05:25:38PM -0400, Waiman Long wrote: > During my rwsem testing, it was found that after a down_read(), the > reader count may occasionally become 0 or even negative. Consequently, > a writer may steal the lock at that time and execute with the reader > in parallel thus break

[PATCH-tip v7 01/20] locking/rwsem: Prevent decrement of reader count before increment

2019-04-28 Thread Waiman Long
During my rwsem testing, it was found that after a down_read(), the reader count may occasionally become 0 or even negative. Consequently, a writer may steal the lock at that time and execute with the reader in parallel thus breaking the mutual exclusion guarantee of the write lock. In other words,