This time I am not changing LWLock semantics :)
Consider the a hash table partitioned in two different ways.
1. having S partitions, guarded by LWLocks on the same cache line.
2. having a single LWLock.
Which one will give better concurrency?
Which one will cost more to lock/unlock?
I argue that having S partitions is better in several different ways.
a. Concurrency of LW_EXCLUSIVE
b. Reduced contention on LWLockWaitListLock
c. Reduced CAS iterations in LWLockAtttemptLock
d. Reduced waits (that implies wait list access and sleeping)
I included a (pointless) benchmark result.
And you can find a longer discussion in 0002 patch.