• Waiman Long's avatar
    locking/rwsem: Remove reader optimistic spinning · 617f3ef9
    Waiman Long authored
    Reader optimistic spinning is helpful when the reader critical section
    is short and there aren't that many readers around. It also improves
    the chance that a reader can get the lock as writer optimistic spinning
    disproportionally favors writers much more than readers.
    
    Since commit d3681e26 ("locking/rwsem: Wake up almost all readers
    in wait queue"), all the waiting readers are woken up so that they can
    all get the read lock and run in parallel. When the number of contending
    readers is large, allowing reader optimistic spinning will likely cause
    reader fragmentation where multiple smaller groups of readers can get
    the read lock in a sequential manner separated by writers. That reduces
    reader parallelism.
    
    One possible way to address that drawback is to limit the number of
    readers (preferably one) that can do optimistic spinning. These readers
    act as representatives of all the waiting readers in the wait queue as
    they will wake up all those waiting reade...
    617f3ef9
lock_events_list.h 3.08 KB