summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-06-05 21:43:20 (GMT)
committerJason Evans <jasone@canonware.com>2016-06-06 04:00:02 (GMT)
commitc4bb17f891768cb57d4559d9ffb53c304448dcdc (patch)
treee876735ca13c87e9cfb684f13a4c583edcec6527
parent42faa9e3e0b4a9347c46153356163bd921c6e90c (diff)
downloadjemalloc-c4bb17f891768cb57d4559d9ffb53c304448dcdc.zip
jemalloc-c4bb17f891768cb57d4559d9ffb53c304448dcdc.tar.gz
jemalloc-c4bb17f891768cb57d4559d9ffb53c304448dcdc.tar.bz2
Fix gdump triggering regression.
Now that extents are not multiples of chunksize, it's necessary to track pages rather than chunks.
-rw-r--r--src/extent.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/extent.c b/src/extent.c
index 0c66e31..0ea10fb 100644
--- a/src/extent.c
+++ b/src/extent.c
@@ -35,8 +35,8 @@ const extent_hooks_t extent_hooks_default = {
};
/* Used exclusively for gdump triggering. */
-static size_t curchunks;
-static size_t highchunks;
+static size_t curpages;
+static size_t highpages;
/******************************************************************************/
/*
@@ -281,16 +281,15 @@ extent_register(tsdn_t *tsdn, const extent_t *extent)
extent_rtree_release(tsdn, elm_a, elm_b);
if (config_prof && opt_prof && extent_active_get(extent)) {
- size_t nadd = (extent_size_get(extent) == 0) ? 1 :
- extent_size_get(extent) / chunksize;
- size_t cur = atomic_add_z(&curchunks, nadd);
- size_t high = atomic_read_z(&highchunks);
- while (cur > high && atomic_cas_z(&highchunks, high, cur)) {
+ size_t nadd = extent_size_get(extent) >> LG_PAGE;
+ size_t cur = atomic_add_z(&curpages, nadd);
+ size_t high = atomic_read_z(&highpages);
+ while (cur > high && atomic_cas_z(&highpages, high, cur)) {
/*
* Don't refresh cur, because it may have decreased
- * since this thread lost the highchunks update race.
+ * since this thread lost the highpages update race.
*/
- high = atomic_read_z(&highchunks);
+ high = atomic_read_z(&highpages);
}
if (cur > high && prof_gdump_get_unlocked())
prof_gdump(tsdn);
@@ -329,10 +328,9 @@ extent_deregister(tsdn_t *tsdn, const extent_t *extent)
extent_rtree_release(tsdn, elm_a, elm_b);
if (config_prof && opt_prof && extent_active_get(extent)) {
- size_t nsub = (extent_size_get(extent) == 0) ? 1 :
- extent_size_get(extent) / chunksize;
- assert(atomic_read_z(&curchunks) >= nsub);
- atomic_sub_z(&curchunks, nsub);
+ size_t nsub = extent_size_get(extent) >> LG_PAGE;
+ assert(atomic_read_z(&curpages) >= nsub);
+ atomic_sub_z(&curpages, nsub);
}
}