Revert "Reduce dbuf_find() lock contention"

This reverts commit 34dbc618f5.  While this
change resolved the lock contention observed for certain workloads, it
inadventantly reduced the maximum hash inserts/removes per second.  This
appears to be due to the slightly higher acquisition cost of a rwlock vs
a mutex.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf
2022-09-19 11:07:15 -07:00
parent e506a0ce40
commit 223b04d23d
3 changed files with 19 additions and 18 deletions
+2 -2
View File
@@ -137,7 +137,7 @@ dbuf_stats_hash_table_data(char *buf, size_t size, void *data)
if (size)
buf[0] = 0;
rw_enter(DBUF_HASH_RWLOCK(h, dsh->idx), RW_READER);
mutex_enter(DBUF_HASH_MUTEX(h, dsh->idx));
for (db = h->hash_table[dsh->idx]; db != NULL; db = db->db_hash_next) {
/*
* Returning ENOMEM will cause the data and header functions
@@ -158,7 +158,7 @@ dbuf_stats_hash_table_data(char *buf, size_t size, void *data)
mutex_exit(&db->db_mtx);
}
rw_exit(DBUF_HASH_RWLOCK(h, dsh->idx));
mutex_exit(DBUF_HASH_MUTEX(h, dsh->idx));
return (error);
}