Re: [Patch] shm bug introduced with pagecache in 2.3.11

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Sat, 20 Nov 1999 14:30:11 +0100 (CET)


On Sat, 20 Nov 1999, Manfred Spraul wrote:

> I never figured out how to upgrade a reader to a writer:
> what if 2 threads acquire the lock 'read', and and both decide to
> promote to "write"?

yes, it's deadlock-land. I had a patch that did this, we can promote a
writer to a reader very cheaply (only one locked-add 0x80000001), but it's
a bit unfinished without having a clean reader-to-writer path. The
reader-to-write path is conceptually hard, because if we fail to get the
write bit immediately then we _have to_ unlock the spinlock (even the read
count) to not deadlock, and this has user-visible effects: in this case
the user cannot assume anymore than the data structure is not modified =>
we are back to the original complexity of restarting the whole thing with
the write lock held. Very little performance gain for lots of hassle.

-- mingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/