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.
This commit is contained in:
Jason Evans
2016-10-13 12:18:38 -07:00
parent e5effef428
commit 577d4572b0
11 changed files with 139 additions and 155 deletions

View File

@@ -53,10 +53,10 @@ large_dalloc_junk_intercept(void *ptr, size_t usize)
}
static void
large_dalloc_maybe_junk_intercept(tsdn_t *tsdn, void *ptr, size_t usize)
large_dalloc_maybe_junk_intercept(void *ptr, size_t usize)
{
large_dalloc_maybe_junk_orig(tsdn, ptr, usize);
large_dalloc_maybe_junk_orig(ptr, usize);
if (ptr == watch_for_junking)
saw_junking = true;
}