On Fri, Nov 20, 2020 at 11:14:16PM -0500, Waiman Long wrote:
@@ -1032,40 +901,16 @@ rwsem_down_read_slowpath(struct rw_semaphore *sem, int state, long count)This comment no longer makes sense..
*
* We can take the read lock directly without doing
* rwsem_optimistic_spin() if the conditions are right.
- * Also wake up other readers if it is the first reader.since we're removing the optimistic spinning entirely on the read side.
*/
- if (!(count & (RWSEM_WRITER_LOCKED | RWSEM_FLAG_HANDOFF)) &&
- rwsem_no_spinners(sem)) {
+ if (!(count & (RWSEM_WRITER_LOCKED | RWSEM_FLAG_HANDOFF))) {
rwsem_set_reader_owned(sem);
lockevent_inc(rwsem_rlock_steal);
- if (rcnt == 1)
- goto wake_readers;
- return sem;
- }
- /*
- * Save the current read-owner of rwsem, if available, and the
- * reader nonspinnable bit.
- */
- waiter.last_rowner = owner;
- if (!(waiter.last_rowner & RWSEM_READER_OWNED))
- waiter.last_rowner &= RWSEM_RD_NONSPINNABLE;
-
- if (!rwsem_can_spin_on_owner(sem, RWSEM_RD_NONSPINNABLE))
- goto queue;
-
- /*
- * Undo read bias from down_read() and do optimistic spinning.
- */
- atomic_long_add(-RWSEM_READER_BIAS, &sem->count);
- adjustment = 0;
- if (rwsem_optimistic_spin(sem, false)) {
Also, I was looking at skipping patch #4, which mucks with the reader
wakeup logic, and afaict this removal doesn't really depend on it.
Or am I missing something?