Skip to content
  • Davidlohr Bueso's avatar
    locking/percpu-rwsem: Replace waitqueue with rcuwait · 52b94129
    Davidlohr Bueso authored
    
    
    The use of any kind of wait queue is an overkill for pcpu-rwsems.
    While one option would be to use the less heavy simple (swait)
    flavor, this is still too much for what pcpu-rwsems needs. For one,
    we do not care about any sort of queuing in that the only (rare) time
    writers (and readers, for that matter) are queued is when trying to
    acquire the regular contended rw_sem. There cannot be any further
    queuing as writers are serialized by the rw_sem in the first place.
    
    Given that percpu_down_write() must not be called after exit_notify(),
    we can replace the bulky waitqueue with rcuwait such that a writer
    can wait for its turn to take the lock. As such, we can avoid the
    queue handling and locking overhead.
    
    Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: dave@stgolabs.net
    Link: http://lkml.kernel.org/r/1484148146-14210-3-git-send-email-dave@stgolabs.net
    
    
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    52b94129