Make dss operations lockless.
Rather than protecting dss operations with a mutex, use atomic
operations. This has negligible impact on synchronization overhead
during typical dss allocation, but is a substantial improvement for
extent_in_dss() and the newly added extent_dss_mergeable(), which can be
called multiple times during extent deallocations.
This change also has the advantage of avoiding tsd in deallocation paths
associated with purging, which resolves potential deadlocks during
thread exit due to attempted tsd resurrection.
This resolves #425.
diff --git a/src/ctl.c b/src/ctl.c
index b4e2208..067b677 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -1527,11 +1527,11 @@
dss_prec_old = arena_dss_prec_get(tsd_tsdn(tsd), arena);
} else {
if (dss_prec != dss_prec_limit &&
- extent_dss_prec_set(tsd_tsdn(tsd), dss_prec)) {
+ extent_dss_prec_set(dss_prec)) {
ret = EFAULT;
goto label_return;
}
- dss_prec_old = extent_dss_prec_get(tsd_tsdn(tsd));
+ dss_prec_old = extent_dss_prec_get();
}
dss = dss_prec_names[dss_prec_old];