• Waiman Long's avatar
    locking/rwsem: Remove rwsem_wake() wakeup optimization · 5c1ec49b
    Waiman Long authored
    After the following commit:
    
      59aabfc7 ("locking/rwsem: Reduce spinlock contention in wakeup after up_read()/up_write()")
    
    the rwsem_wake() forgoes doing a wakeup if the wait_lock cannot be directly
    acquired and an optimistic spinning locker is present.  This can help performance
    by avoiding spinning on the wait_lock when it is contended.
    
    With the later commit:
    
      133e89ef ("locking/rwsem: Enable lockless waiter wakeup(s)")
    
    the performance advantage of the above optimization diminishes as the average
    wait_lock hold time become much shorter.
    
    With a later patch that supports rwsem lock handoff, we can no
    longer relies on the fact that the presence of an optimistic spinning
    locker will ensure that the lock will be acquired by a task soon and
    rwsem_wake() will be called later on to wake up waiters. This can lead
    to missed wakeup and application hang.
    
    So the original 59aabfc7 commit has to be reverted.
    Signed-off-by: default avatarWaiman Long <longman@redhat.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Tim Chen <tim.c.chen@linux.intel.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: huang ying <huang.ying.caritas@gmail.com>
    Link: https://lkml.kernel.org/r/20190520205918.22251-3-longman@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    5c1ec49b
rwsem-xadd.c 19 KB