aboutsummaryrefslogtreecommitdiffstats
path: root/src/ckh.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2015-02-12 00:12:44 -0800
committerJason Evans <jasone@canonware.com>2015-02-12 00:15:24 -0800
commitf30e261c5b85d2900224f91c6d426a23dce94fe9 (patch)
tree85448a4020e5ed51dfa35e412f20a5ce4d740537 /src/ckh.c
parent064dbfbaf76617643bbbe66cbcc880e7ee9ec00f (diff)
downloadplatform_external_jemalloc_new-f30e261c5b85d2900224f91c6d426a23dce94fe9.tar.gz
platform_external_jemalloc_new-f30e261c5b85d2900224f91c6d426a23dce94fe9.tar.bz2
platform_external_jemalloc_new-f30e261c5b85d2900224f91c6d426a23dce94fe9.zip
Update ckh to support metadata allocation tracking.
Diffstat (limited to 'src/ckh.c')
-rw-r--r--src/ckh.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/ckh.c b/src/ckh.c
index ad075d60..da78d1b4 100644
--- a/src/ckh.c
+++ b/src/ckh.c
@@ -270,8 +270,8 @@ ckh_grow(tsd_t *tsd, ckh_t *ckh)
ret = true;
goto label_return;
}
- tab = (ckhc_t *)ipalloct(tsd, usize, CACHELINE, true, NULL,
- NULL);
+ tab = (ckhc_t *)ipallocztm(tsd, usize, CACHELINE, true, NULL,
+ true, NULL);
if (tab == NULL) {
ret = true;
goto label_return;
@@ -283,12 +283,12 @@ ckh_grow(tsd_t *tsd, ckh_t *ckh)
ckh->lg_curbuckets = lg_curcells - LG_CKH_BUCKET_CELLS;
if (!ckh_rebuild(ckh, tab)) {
- idalloc(tsd, tab);
+ idalloctm(tsd, tab, tcache_get(tsd, false), true);
break;
}
/* Rebuilding failed, so back out partially rebuilt table. */
- idalloc(tsd, ckh->tab);
+ idalloctm(tsd, ckh->tab, tcache_get(tsd, false), true);
ckh->tab = tab;
ckh->lg_curbuckets = lg_prevbuckets;
}
@@ -314,7 +314,8 @@ ckh_shrink(tsd_t *tsd, ckh_t *ckh)
usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE);
if (usize == 0)
return;
- tab = (ckhc_t *)ipalloct(tsd, usize, CACHELINE, true, NULL, NULL);
+ tab = (ckhc_t *)ipallocztm(tsd, usize, CACHELINE, true, NULL, true,
+ NULL);
if (tab == NULL) {
/*
* An OOM error isn't worth propagating, since it doesn't
@@ -329,7 +330,7 @@ ckh_shrink(tsd_t *tsd, ckh_t *ckh)
ckh->lg_curbuckets = lg_curcells - LG_CKH_BUCKET_CELLS;
if (!ckh_rebuild(ckh, tab)) {
- idalloc(tsd, tab);
+ idalloctm(tsd, tab, tcache_get(tsd, false), true);
#ifdef CKH_COUNT
ckh->nshrinks++;
#endif
@@ -337,7 +338,7 @@ ckh_shrink(tsd_t *tsd, ckh_t *ckh)
}
/* Rebuilding failed, so back out partially rebuilt table. */
- idalloc(tsd, ckh->tab);
+ idalloctm(tsd, ckh->tab, tcache_get(tsd, false), true);
ckh->tab = tab;
ckh->lg_curbuckets = lg_prevbuckets;
#ifdef CKH_COUNT
@@ -390,7 +391,8 @@ ckh_new(tsd_t *tsd, ckh_t *ckh, size_t minitems, ckh_hash_t *hash,
ret = true;
goto label_return;
}
- ckh->tab = (ckhc_t *)ipalloct(tsd, usize, CACHELINE, true, NULL, NULL);
+ ckh->tab = (ckhc_t *)ipallocztm(tsd, usize, CACHELINE, true, NULL, true,
+ NULL);
if (ckh->tab == NULL) {
ret = true;
goto label_return;
@@ -419,7 +421,7 @@ ckh_delete(tsd_t *tsd, ckh_t *ckh)
(unsigned long long)ckh->nrelocs);
#endif
- idalloc(tsd, ckh->tab);
+ idalloctm(tsd, ckh->tab, tcache_get(tsd, false), true);
if (config_debug)
memset(ckh, 0x5a, sizeof(ckh_t));
}