Fix gdump triggering regression.
Now that extents are not multiples of chunksize, it's necessary to track pages rather than chunks.
This commit is contained in:
parent
42faa9e3e0
commit
c4bb17f891
24
src/extent.c
24
src/extent.c
@ -35,8 +35,8 @@ const extent_hooks_t extent_hooks_default = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Used exclusively for gdump triggering. */
|
/* Used exclusively for gdump triggering. */
|
||||||
static size_t curchunks;
|
static size_t curpages;
|
||||||
static size_t highchunks;
|
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);
|
extent_rtree_release(tsdn, elm_a, elm_b);
|
||||||
|
|
||||||
if (config_prof && opt_prof && extent_active_get(extent)) {
|
if (config_prof && opt_prof && extent_active_get(extent)) {
|
||||||
size_t nadd = (extent_size_get(extent) == 0) ? 1 :
|
size_t nadd = extent_size_get(extent) >> LG_PAGE;
|
||||||
extent_size_get(extent) / chunksize;
|
size_t cur = atomic_add_z(&curpages, nadd);
|
||||||
size_t cur = atomic_add_z(&curchunks, nadd);
|
size_t high = atomic_read_z(&highpages);
|
||||||
size_t high = atomic_read_z(&highchunks);
|
while (cur > high && atomic_cas_z(&highpages, high, cur)) {
|
||||||
while (cur > high && atomic_cas_z(&highchunks, high, cur)) {
|
|
||||||
/*
|
/*
|
||||||
* Don't refresh cur, because it may have decreased
|
* 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())
|
if (cur > high && prof_gdump_get_unlocked())
|
||||||
prof_gdump(tsdn);
|
prof_gdump(tsdn);
|
||||||
@ -329,10 +328,9 @@ extent_deregister(tsdn_t *tsdn, const extent_t *extent)
|
|||||||
extent_rtree_release(tsdn, elm_a, elm_b);
|
extent_rtree_release(tsdn, elm_a, elm_b);
|
||||||
|
|
||||||
if (config_prof && opt_prof && extent_active_get(extent)) {
|
if (config_prof && opt_prof && extent_active_get(extent)) {
|
||||||
size_t nsub = (extent_size_get(extent) == 0) ? 1 :
|
size_t nsub = extent_size_get(extent) >> LG_PAGE;
|
||||||
extent_size_get(extent) / chunksize;
|
assert(atomic_read_z(&curpages) >= nsub);
|
||||||
assert(atomic_read_z(&curchunks) >= nsub);
|
atomic_sub_z(&curpages, nsub);
|
||||||
atomic_sub_z(&curchunks, nsub);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user