diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2021-04-16 18:44:43 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-16 18:47:08 -0700 |
commit | 3b685753b4e9632ed8cde1ae284c79a9a14230b9 (patch) | |
tree | 014c090423c6fb3d75c2019421ec7177d5f9ef7e /pkg/sentry/fsimpl/kernfs/BUILD | |
parent | 0c3e8daf503e011f0ef3e2a1c6d8b6ffd946acab (diff) |
[perf] Reduce contention due to renameMu in gofer client.
Runsc build benchmark's mutex profile shows that we are wasting roughly 25-30
seconds waiting for filesystem.renameMu to get unlocked. Earlier
checkCachingLocked required the renameMu to be locked for writing. This is a
filesystem wide lock which puts all other filesystem operations on hold and
hence is really expensive. Something to note is that all path resolution
operations hold renameMu for reading.
With this change, we allow to check for caching without even holding renameMu.
This change introduces more fine grained locks (fs.cacheMu and dentry.cachingMu)
which protect the cache (removing the requirement to hold renameMu for writing
to modify the cache) and synchronize concurrent dentry caching attempts on a per
dentry basis. We still require to hold renameMu for writing while destroying
dentries and evicting from the cache but this still significantly reduces the
write locking critical section.
Local benchmarking showed that this improved runsc build benchmark time by 4-5%.
Across 6 runs, without this change it took 310.9025 seconds to build runsc
while with this change it took 296.127 seconds.
Runsc build benchmark's mutex profile: https://gvisor.dev/profile/gvisor-buildkite/78a3f968-36ca-4944-93f7-77a8792d56b4/28a1d260-790b-4a9e-94da-a4daede08ee3/tmp/profile/ptrace/BenchmarkBuildRunsc/page_cache.clean/filesystem.bindfs/benchmarks/runsc/mutex.pprof/flamegraph
PiperOrigin-RevId: 368958136
Diffstat (limited to 'pkg/sentry/fsimpl/kernfs/BUILD')
0 files changed, 0 insertions, 0 deletions