forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitab5194e
committed
Improve LWLock scalability.
The old LWLock implementation had the problem that concurrent lockacquisitions required exclusively acquiring a spinlock. Often thatcould lead to acquirers waiting behind the spinlock, even if theactual LWLock was free.The new implementation doesn't acquire the spinlock when acquiring thelock itself. Instead the new atomic operations are used to atomicallymanipulate the state. Only the waitqueue, used solely in the slowpath, is still protected by the spinlock. Check lwlock.c's header foran explanation about the used algorithm.For some common workloads on larger machines this can yieldsignificant performance improvements. Particularly in read mostlyworkloads.Reviewed-By: Amit Kapila and Robert HaasAuthor: Andres FreundDiscussion: 20130926225545.GB26663@awork2.anarazel.de1 parent7882c3b commitab5194e