yesterday I wnated to increase my knowledge about Linux 2.2 and
visited some files. In asm/spinlock.h (for arch i386) I noticed that
the symbol _SMP_ (or similar) is still used while it should be
something like CONFIG_SMP in 2.2-pre7 now. That's also true for
<asm/atomic.h> and possibly others.
But another thing came into my mind: In theory it seems a good idea
to have upgradable and downgradable spinlocks:
Upgrade: Change from read lock to write lock without loosing it
temporarily
Downgrade: Change from write lock to read lock
While downgrading should be very easy, upgrading seems tricky. My
solution basically was: If there is exactly one reader attached, it
must be the "owner" of the lock (the thread itself). Then you could
atomically "xor 0x80000001" to change the read lock to a write lock.
The advantages I see: more concurrency. I don't see additionaly
dangers of deadlocks here. (But I can be wrong)
Regards,
Ulrich Windl
P.S. I hope my CVS tree wasn't mixing different versions...
-
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/