On Thu, Nov 02, 2006 at 03:15:33PM -0800, Linus Torvalds wrote:
> On Thu, 2 Nov 2006, Mikulas Patocka wrote:
> > * There is a rw semaphore that is locked for read for nearly all operations
> > and locked for write only rarely. However locking for read causes cache line
> > pingpong on SMP systems. Do you have an idea how to make it better?
[ . . . ]
> (Seqlocks could be changed to drop the first requirement, although it
> could cause some serious starvation issues, so I'm not sure it's a good
> idea. For RCU the atomic nature is pretty much designed-in.)
I can't help putting in a plug for SRCU, which is in the 2.6.19-rc series,
and which allows readers to sleep. (http://lwn.net/Articles/202847/)
SRCU allows readers and writers to run concurrently (as do all forms of
RCU). If this is a problem, it might be worth looking into Gautham
Shenoy's reader-writer lock built on top of RCU. (A version for hotplug
may be found at http://lkml.org/lkml/2006/10/26/73.) This approach
keeps the reader-writer-lock semantics, but gets rid of cache thrashing.
That said, writers have to wait for a grace period.
And as Linus pointed out, if you have disk I/O involved, you probably
won't notice normal reader-writer-lock overhead.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Video 4 Linux]
[Linux for the blind]