PATCH powerpc Merge asm-ppc*/rwsem.h

Paul Mackerras paulus at samba.org
Sat Sep 24 10:46:33 EST 2005


David Howells writes:

> rwsems on ppc64 should really be using a 64-bit counter, not a 32-bit counter,
> otherwise you limit the maximum number of processes to 32K-ish.
> 
> The counter should be "signed long" really.

It has long annoyed me that we waste half the bits in the rwsem
counter, just because you assume a lowest-common-denominator set of
atomic ops.  IIRC your implementation replaced the earlier ppc
implementation which had a 32-bit counter and didn't have the 32k
process limit.

I'd have to study it in more detail, but I strongly suspect that with
an atomic operation that did something like

	*p = max(*p, limit) + inc

atomically (or alternatively a min), we could increase the limit to at
least 1G processes with a 32-bit counter, without needing to change
your common slow-path implementation.

Such an atomic op is easy to implement with load-and-reserve /
store-conditional instructions.  Look at __sem_update_count in
arch/ppc64/kernel/semaphore.c for an example.

Paul.



More information about the Linuxppc64-dev mailing list