> > So ho-hum. As a first step, David, could you please take a look into > what's up with downgrade_write()? Yes. Patch attached. The critical bit is in the hunk beginning at line 95. It appears my rwsem testsuite didn't have a downgrade write test. I added one and the bug became obvious. > (Then again, we need to have a serious think about the overflow bug. It's > fatal. Should we fix it? If so, the current rwsem implementation is > probably unsalvageable). The optimised rwsem implementation is probably okay, provided you don't have a 32-bit machine with silly amounts of memory, for which the 32767 process limit is probably reasonable. Maybe make it contingent on CONFIG_HIGHMEM on X86? If you don't want to use an optimised version, there _is_ a spinlock version as well. For 64-bit archs like x86_64 and ppc64 this algorithm can easily made to use a 64-bit counter (lib/rwsem.c wants a signed long counter), so it's just a matter of using XADDQ, LDARX/STDCX or equivalents (I have patches for those two). I've also got MIPS64 patches somewhere too, though they're horribly out of date. Alpha and S390 already do the 64-bit counter thing. And if sparc64 has a 64-bit CAS, that can be used. IA64's rwsems should be 64-bitable too. Using a 64-bit counter gives you a limit of 2 billion processes. David