]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
lockf: add per-chain locks to the owner hash
authorMateusz Guzik <mjg@FreeBSD.org>
Mon, 23 Apr 2018 08:23:10 +0000 (08:23 +0000)
committerMateusz Guzik <mjg@FreeBSD.org>
Mon, 23 Apr 2018 08:23:10 +0000 (08:23 +0000)
commit833dc05a6e957daf587c9570582bfb685c3e8c53
tree26991543a029e99959cdcbb0648433e92425bfb1
parent63286976b55d1659e0baf391e8a276b1074b019e
lockf: add per-chain locks to the owner hash

This combined with previous changes significantly depessimizes the behaviour
under contentnion.

In particular the lock1_processes test (locking/unlocking separate files)
from the will-it-scale suite was executed with 128 concurrency on a
4-socket Broadwell with 128 hardware threads.

Operations/second (lock+unlock) go from ~750000 to ~45000000 (6000%)
For reference single-process is ~1680000 (i.e. on stock kernel the resulting
perf is less than *half* of the single-threaded run),

Note this still does not really scale all that well as the locks were just
bolted on top of the current implementation. Significant room for improvement
is still here. In particular the top performance fluctuates depending on the
extent of false sharing in given run (which extends beyond the file).
Added chain+lock pairs were not padded w.r.t. cacheline size.

One big ticket item is the hash used for spreading threads: it used to be the
process pid (which basically serialized all threaded ops). Temporarily the
vnode addr was slapped in instead.

Tested by:      pho
sys/kern/kern_lockf.c