• Linus Torvalds's avatar
    futex: revert back to the explicit waiter counting code · 11d4616b
    Linus Torvalds authored
    Srikar Dronamraju reports that commit b0c29f79 ("futexes: Avoid
    taking the hb->lock if there's nothing to wake up") causes java threads
    getting stuck on futexes when runing specjbb on a power7 numa box.
    
    The cause appears to be that the powerpc spinlocks aren't using the same
    ticket lock model that we use on x86 (and other) architectures, which in
    turn result in the "spin_is_locked()" test in hb_waiters_pending()
    occasionally reporting an unlocked spinlock even when there are pending
    waiters.
    
    So this reinstates Davidlohr Bueso's original explicit waiter counting
    code, which I had convinced Davidlohr to drop in favor of figuring out
    the pending waiters by just using the existing state of the spinlock and
    the wait queue.
    Reported-and-tested-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
    Original-code-by: default avatarDavidlohr Bueso <davidlohr@hp.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    11d4616b
futex.c 76.5 KB