Commit 533a071f authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Linus Torvalds

[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.
parent c631700d
...@@ -41,8 +41,7 @@ static inline struct rw_semaphore *__rwsem_do_wake(struct rw_semaphore *sem, int ...@@ -41,8 +41,7 @@ static inline struct rw_semaphore *__rwsem_do_wake(struct rw_semaphore *sem, int
{ {
struct rwsem_waiter *waiter; struct rwsem_waiter *waiter;
struct list_head *next; struct list_head *next;
signed long oldcount; signed long oldcount, woken, loop;
int woken, loop;
rwsemtrace(sem,"Entering __rwsem_do_wake"); rwsemtrace(sem,"Entering __rwsem_do_wake");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment