• Ivan Kokshaysky's avatar
    [PATCH] Fix rwsem contention case on alpha/s390x · 533a071f
    Ivan Kokshaysky authored
    Thanks to Dru <andru@treshna.com>, who provided an easy way to reproduce
    the problem.
    
    What we have in lib/rwsem.c:__rwsem_do_wake():
    	int woken, loop;
    	^^^
    and several lines below:
    	loop = woken;
    	woken *= RWSEM_ACTIVE_BIAS-RWSEM_WAITING_BIAS;
    	woken -= RWSEM_ACTIVE_BIAS;
    
    However, rw_semaphore->count is 64-bit on Alpha, so
    RWSEM_WAITING_BIAS has been defined as -0x0000000100000000L.
    Obviously, this blows up in the write contention case.
    533a071f
rwsem.c 6.31 KB