[PATCH] Fix rwsem contention case on alpha/s390x
authorIvan Kokshaysky <ink@jurassic.park.msu.ru>
Wed, 28 Apr 2004 02:58:52 +0000 (19:58 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 28 Apr 2004 02:58:52 +0000 (19:58 -0700)
commit533a071fbc819080f1e70da2ef99337d26912a74
treeca1d82dd43b99094d0a43a97ef38722522d783d6
parentc631700d2d729980137611b32d6b56723d1d57e5
[PATCH] Fix rwsem contention case on alpha/s390x

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.
lib/rwsem.c