summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorMatthew Ahrens <mahrens@delphix.com>2017-03-28 15:31:49 -0700
committerPrakash Surya <prakash.surya@delphix.com>2017-06-07 18:56:23 -0700
commitdbfd9f930004c390a2ce2cf850c71b4f880eef9c (patch)
tree1816685cb776fddc8307aa751627ad7cc8c80a8e /usr/src
parent690031d326342fa4ea28b5e80f1ad6a16281519d (diff)
downloadillumos-joyent-dbfd9f930004c390a2ce2cf850c71b4f880eef9c.tar.gz
8156 dbuf_evict_notify() does not need dbuf_evict_lock
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Paul Dagnelie <pcd@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/fs/zfs/dbuf.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/usr/src/uts/common/fs/zfs/dbuf.c b/usr/src/uts/common/fs/zfs/dbuf.c
index 23d4d3b0bf..64700c5ba6 100644
--- a/usr/src/uts/common/fs/zfs/dbuf.c
+++ b/usr/src/uts/common/fs/zfs/dbuf.c
@@ -561,19 +561,15 @@ dbuf_evict_notify(void)
if (tsd_get(zfs_dbuf_evict_key) != NULL)
return;
+ /*
+ * We check if we should evict without holding the dbuf_evict_lock,
+ * because it's OK to occasionally make the wrong decision here,
+ * and grabbing the lock results in massive lock contention.
+ */
if (refcount_count(&dbuf_cache_size) > dbuf_cache_max_bytes) {
- boolean_t evict_now = B_FALSE;
-
- mutex_enter(&dbuf_evict_lock);
- if (refcount_count(&dbuf_cache_size) > dbuf_cache_max_bytes) {
- evict_now = dbuf_cache_above_hiwater();
- cv_signal(&dbuf_evict_cv);
- }
- mutex_exit(&dbuf_evict_lock);
-
- if (evict_now) {
+ if (dbuf_cache_above_hiwater())
dbuf_evict_one();
- }
+ cv_signal(&dbuf_evict_cv);
}
}