rwlocks: poor performance with adaptive spinning

看板FB_smp作者時間18年前 (2007/09/23 10:58), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/10 (看更多)
Recently several people have reported problems of starvation with rwlocks. In particular, users which tried to use rwlock on big SMP environment (16+ CPUs) found them rather subjected to poor performances and to starvation of waiters. Inspecting the code, something strange about adaptive spinning popped up: basically, for rwlocks, adaptive spinning stubs seem to be customed too down in the decisioning-loop. The desposition of the stub will let the thread that would adaptively spin, to set the respecitve (both read or write) waiters flag on, which means that the owner of the lock will go down in the hard path of locking functions and will performe a full wakeup even if the waiters queues can result empty. This is a big penalty for adaptive spinning which can make it completely useless. In addiction to this, adaptive spinning only runs in the turnstile spinlock path which is not ideal. This patch ports the approach alredy used for adaptive spinning in sx locks to rwlocks: http://users.gufi.org/~rookie/works/patches/kern_rwlock.diff In sx it is unlikely to see big benefits because they are held for too long times, but for rwlocks situation is rather different. I would like to see if people can do benchmarks with this patch (maybe in private environments?) as I'm not able to do them in short times. Adaptive spinning in rwlocks can be improved further with other tricks (like adding a backoff counter, for example, or trying to spin with the lock held in read mode too), but we first should be sure to start with a solid base. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein _______________________________________________ freebsd-smp@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-smp To unsubscribe, send any mail to "freebsd-smp-unsubscribe@freebsd.org"
文章代碼(AID): #16zTPV00 (FB_smp)
討論串 (同標題文章)
文章代碼(AID): #16zTPV00 (FB_smp)