PAC: Add an init function.
This commit is contained in:
parent
722652222a
commit
7efcb946c4
@ -127,6 +127,7 @@ C_SRCS := $(srcroot)src/jemalloc.c \
|
|||||||
$(srcroot)src/nstime.c \
|
$(srcroot)src/nstime.c \
|
||||||
$(srcroot)src/pa.c \
|
$(srcroot)src/pa.c \
|
||||||
$(srcroot)src/pa_extra.c \
|
$(srcroot)src/pa_extra.c \
|
||||||
|
$(srcroot)src/pac.c \
|
||||||
$(srcroot)src/pages.c \
|
$(srcroot)src/pages.c \
|
||||||
$(srcroot)src/peak_event.c \
|
$(srcroot)src/peak_event.c \
|
||||||
$(srcroot)src/prof.c \
|
$(srcroot)src/prof.c \
|
||||||
|
@ -24,4 +24,7 @@ struct pac_s {
|
|||||||
edata_cache_t *edata_cache;
|
edata_cache_t *edata_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool pac_init(tsdn_t *tsdn, pac_t *pac, unsigned ind,
|
||||||
|
edata_cache_t *edata_cache);
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_PAC_H */
|
#endif /* JEMALLOC_INTERNAL_PAC_H */
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
<ClCompile Include="..\..\..\..\src\nstime.c" />
|
<ClCompile Include="..\..\..\..\src\nstime.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\pa.c" />
|
<ClCompile Include="..\..\..\..\src\pa.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\pa_extra.c" />
|
<ClCompile Include="..\..\..\..\src\pa_extra.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\src\pac.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\pages.c" />
|
<ClCompile Include="..\..\..\..\src\pages.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\peak_event.c" />
|
<ClCompile Include="..\..\..\..\src\peak_event.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\prof.c" />
|
<ClCompile Include="..\..\..\..\src\prof.c" />
|
||||||
|
@ -88,6 +88,9 @@
|
|||||||
<ClCompile Include="..\..\..\..\src\pa_extra.c">
|
<ClCompile Include="..\..\..\..\src\pa_extra.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\..\src\pac.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\..\..\src\pages.c">
|
<ClCompile Include="..\..\..\..\src\pages.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
<ClCompile Include="..\..\..\..\src\nstime.c" />
|
<ClCompile Include="..\..\..\..\src\nstime.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\pa.c" />
|
<ClCompile Include="..\..\..\..\src\pa.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\pa_extra.c" />
|
<ClCompile Include="..\..\..\..\src\pa_extra.c" />
|
||||||
|
<ClCompile Include="..\..\..\..\src\pac.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\pages.c" />
|
<ClCompile Include="..\..\..\..\src\pages.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\peak_event.c" />
|
<ClCompile Include="..\..\..\..\src\peak_event.c" />
|
||||||
<ClCompile Include="..\..\..\..\src\prof.c" />
|
<ClCompile Include="..\..\..\..\src\prof.c" />
|
||||||
|
@ -88,6 +88,9 @@
|
|||||||
<ClCompile Include="..\..\..\..\src\pa_extra.c">
|
<ClCompile Include="..\..\..\..\src\pa_extra.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\..\src\pac.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\..\..\src\pages.c">
|
<ClCompile Include="..\..\..\..\src\pages.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
33
src/pa.c
33
src/pa.c
@ -26,39 +26,12 @@ pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, emap_t *emap, base_t *base,
|
|||||||
nstime_t *cur_time, ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
|
nstime_t *cur_time, ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
|
||||||
/* This will change eventually, but for now it should hold. */
|
/* This will change eventually, but for now it should hold. */
|
||||||
assert(base_ind_get(base) == ind);
|
assert(base_ind_get(base) == ind);
|
||||||
/*
|
|
||||||
* Delay coalescing for dirty extents despite the disruptive effect on
|
|
||||||
* memory layout for best-fit extent allocation, since cached extents
|
|
||||||
* are likely to be reused soon after deallocation, and the cost of
|
|
||||||
* merging/splitting extents is non-trivial.
|
|
||||||
*/
|
|
||||||
if (ecache_init(tsdn, &shard->pac.ecache_dirty, extent_state_dirty, ind,
|
|
||||||
/* delay_coalesce */ true)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Coalesce muzzy extents immediately, because operations on them are in
|
|
||||||
* the critical path much less often than for dirty extents.
|
|
||||||
*/
|
|
||||||
if (ecache_init(tsdn, &shard->pac.ecache_muzzy, extent_state_muzzy, ind,
|
|
||||||
/* delay_coalesce */ false)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Coalesce retained extents immediately, in part because they will
|
|
||||||
* never be evicted (and therefore there's no opportunity for delayed
|
|
||||||
* coalescing), but also because operations on retained extents are not
|
|
||||||
* in the critical path.
|
|
||||||
*/
|
|
||||||
if (ecache_init(tsdn, &shard->pac.ecache_retained, extent_state_retained,
|
|
||||||
ind, /* delay_coalesce */ false)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (edata_cache_init(&shard->edata_cache, base)) {
|
if (edata_cache_init(&shard->edata_cache, base)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
shard->pac.edata_cache = &shard->edata_cache;
|
if (pac_init(tsdn, &shard->pac, ind, &shard->edata_cache)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (ecache_grow_init(tsdn, &shard->ecache_grow)) {
|
if (ecache_grow_init(tsdn, &shard->ecache_grow)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
39
src/pac.c
Normal file
39
src/pac.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "jemalloc/internal/jemalloc_preamble.h"
|
||||||
|
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||||
|
|
||||||
|
#include "jemalloc/internal/pac.h"
|
||||||
|
|
||||||
|
bool
|
||||||
|
pac_init(tsdn_t *tsdn, pac_t *pac, unsigned ind, edata_cache_t *edata_cache) {
|
||||||
|
/*
|
||||||
|
* Delay coalescing for dirty extents despite the disruptive effect on
|
||||||
|
* memory layout for best-fit extent allocation, since cached extents
|
||||||
|
* are likely to be reused soon after deallocation, and the cost of
|
||||||
|
* merging/splitting extents is non-trivial.
|
||||||
|
*/
|
||||||
|
if (ecache_init(tsdn, &pac->ecache_dirty, extent_state_dirty, ind,
|
||||||
|
/* delay_coalesce */ true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Coalesce muzzy extents immediately, because operations on them are in
|
||||||
|
* the critical path much less often than for dirty extents.
|
||||||
|
*/
|
||||||
|
if (ecache_init(tsdn, &pac->ecache_muzzy, extent_state_muzzy, ind,
|
||||||
|
/* delay_coalesce */ false)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Coalesce retained extents immediately, in part because they will
|
||||||
|
* never be evicted (and therefore there's no opportunity for delayed
|
||||||
|
* coalescing), but also because operations on retained extents are not
|
||||||
|
* in the critical path.
|
||||||
|
*/
|
||||||
|
if (ecache_init(tsdn, &pac->ecache_retained, extent_state_retained,
|
||||||
|
ind, /* delay_coalesce */ false)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pac->edata_cache = edata_cache;
|
||||||
|
return false;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user