Rename the arenas.extend mallctl to arenas.create.
This commit is contained in:
parent
3dc4e83ccb
commit
0f04bb1d6f
@ -1457,8 +1457,8 @@ malloc_conf = "xmalloc:true";]]></programlisting>
|
|||||||
<literal>--</literal>
|
<literal>--</literal>
|
||||||
</term>
|
</term>
|
||||||
<listitem><para>Discard all of the arena's extant allocations. This
|
<listitem><para>Discard all of the arena's extant allocations. This
|
||||||
interface can only be used with arenas created via <link
|
interface can only be used with arenas explicitly created via <link
|
||||||
linkend="arenas.extend"><mallctl>arenas.extend</mallctl></link>. None
|
linkend="arenas.create"><mallctl>arenas.create</mallctl></link>. None
|
||||||
of the arena's discarded/cached allocations may accessed afterward. As
|
of the arena's discarded/cached allocations may accessed afterward. As
|
||||||
part of this requirement, all thread caches which were used to
|
part of this requirement, all thread caches which were used to
|
||||||
allocate/deallocate in conjunction with the arena must be flushed
|
allocate/deallocate in conjunction with the arena must be flushed
|
||||||
@ -1504,8 +1504,8 @@ malloc_conf = "xmalloc:true";]]></programlisting>
|
|||||||
arena <i>. The functions must be capable of operating on all
|
arena <i>. The functions must be capable of operating on all
|
||||||
extant extents associated with arena <i>, usually by passing
|
extant extents associated with arena <i>, usually by passing
|
||||||
unknown extents to the replaced functions. In practice, it is feasible
|
unknown extents to the replaced functions. In practice, it is feasible
|
||||||
to control allocation for arenas created via <link
|
to control allocation for arenas explicitly created via <link
|
||||||
linkend="arenas.extend"><mallctl>arenas.extend</mallctl></link> such
|
linkend="arenas.create"><mallctl>arenas.create</mallctl></link> such
|
||||||
that all extents originate from an application-supplied extent allocator
|
that all extents originate from an application-supplied extent allocator
|
||||||
(by specifying the custom extent hook functions during arena creation),
|
(by specifying the custom extent hook functions during arena creation),
|
||||||
but the automatically created arenas will have already created extents
|
but the automatically created arenas will have already created extents
|
||||||
@ -1836,15 +1836,15 @@ struct extent_hooks_s {
|
|||||||
class.</para></listitem>
|
class.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry id="arenas.extend">
|
<varlistentry id="arenas.create">
|
||||||
<term>
|
<term>
|
||||||
<mallctl>arenas.extend</mallctl>
|
<mallctl>arenas.create</mallctl>
|
||||||
(<type>unsigned</type>, <type>extent_hooks_t *</type>)
|
(<type>unsigned</type>, <type>extent_hooks_t *</type>)
|
||||||
<literal>rw</literal>
|
<literal>rw</literal>
|
||||||
</term>
|
</term>
|
||||||
<listitem><para>Extend the array of arenas by appending a new arena with
|
<listitem><para>Explicitly create a new arena outside the range of
|
||||||
optionally specified extent hooks, and returning the new arena
|
automatically managed arenas, with optionally specified extent hooks,
|
||||||
index.</para></listitem>
|
and return the new arena index.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry id="prof.thread_active_init">
|
<varlistentry id="prof.thread_active_init">
|
||||||
|
@ -148,9 +148,9 @@ struct arena_s {
|
|||||||
* atomic operations. Each thread has two distinct assignments, one for
|
* atomic operations. Each thread has two distinct assignments, one for
|
||||||
* application-serving allocation, and the other for internal metadata
|
* application-serving allocation, and the other for internal metadata
|
||||||
* allocation. Internal metadata must not be allocated from arenas
|
* allocation. Internal metadata must not be allocated from arenas
|
||||||
* created via the arenas.extend mallctl, because the arena.<i>.reset
|
* explicitly created via the arenas.create mallctl, because the
|
||||||
* mallctl indiscriminately discards all allocations for the affected
|
* arena.<i>.reset mallctl indiscriminately discards all allocations for
|
||||||
* arena.
|
* the affected arena.
|
||||||
*
|
*
|
||||||
* 0: Application allocation.
|
* 0: Application allocation.
|
||||||
* 1: Internal metadata allocation.
|
* 1: Internal metadata allocation.
|
||||||
|
@ -133,7 +133,7 @@ CTL_PROTO(arenas_tcache_max)
|
|||||||
CTL_PROTO(arenas_nbins)
|
CTL_PROTO(arenas_nbins)
|
||||||
CTL_PROTO(arenas_nhbins)
|
CTL_PROTO(arenas_nhbins)
|
||||||
CTL_PROTO(arenas_nlextents)
|
CTL_PROTO(arenas_nlextents)
|
||||||
CTL_PROTO(arenas_extend)
|
CTL_PROTO(arenas_create)
|
||||||
CTL_PROTO(prof_thread_active_init)
|
CTL_PROTO(prof_thread_active_init)
|
||||||
CTL_PROTO(prof_active)
|
CTL_PROTO(prof_active)
|
||||||
CTL_PROTO(prof_dump)
|
CTL_PROTO(prof_dump)
|
||||||
@ -323,7 +323,7 @@ static const ctl_named_node_t arenas_node[] = {
|
|||||||
{NAME("bin"), CHILD(indexed, arenas_bin)},
|
{NAME("bin"), CHILD(indexed, arenas_bin)},
|
||||||
{NAME("nlextents"), CTL(arenas_nlextents)},
|
{NAME("nlextents"), CTL(arenas_nlextents)},
|
||||||
{NAME("lextent"), CHILD(indexed, arenas_lextent)},
|
{NAME("lextent"), CHILD(indexed, arenas_lextent)},
|
||||||
{NAME("extend"), CTL(arenas_extend)}
|
{NAME("create"), CTL(arenas_create)}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ctl_named_node_t prof_node[] = {
|
static const ctl_named_node_t prof_node[] = {
|
||||||
@ -1780,7 +1780,7 @@ arenas_lextent_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
arenas_extend_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
|
arenas_create_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
|
||||||
size_t *oldlenp, void *newp, size_t newlen)
|
size_t *oldlenp, void *newp, size_t newlen)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -533,7 +533,7 @@ arena_tdata_get_hard(tsd_t *tsd, unsigned ind)
|
|||||||
* Copy to tdata array. It's possible that the actual number of arenas
|
* Copy to tdata array. It's possible that the actual number of arenas
|
||||||
* has increased since narenas_total_get() was called above, but that
|
* has increased since narenas_total_get() was called above, but that
|
||||||
* causes no correctness issues unless two threads concurrently execute
|
* causes no correctness issues unless two threads concurrently execute
|
||||||
* the arenas.extend mallctl, which we trust mallctl synchronization to
|
* the arenas.create mallctl, which we trust mallctl synchronization to
|
||||||
* prevent.
|
* prevent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ thd_start(void *arg)
|
|||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
sz = sizeof(arena_ind);
|
sz = sizeof(arena_ind);
|
||||||
assert_d_eq(mallctl("arenas.extend", (void *)&arena_ind, &sz, NULL, 0),
|
assert_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz, NULL, 0),
|
||||||
0, "Error in arenas.extend");
|
0, "Error in arenas.create");
|
||||||
|
|
||||||
if (thread_ind % 4 != 3) {
|
if (thread_ind % 4 != 3) {
|
||||||
size_t mib[3];
|
size_t mib[3];
|
||||||
|
@ -292,7 +292,7 @@ TEST_BEGIN(test_extent_manual_hook)
|
|||||||
size_t hooks_miblen;
|
size_t hooks_miblen;
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("arenas.extend", (void *)&arena_ind, &sz, NULL, 0),
|
assert_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz, NULL, 0),
|
||||||
0, "Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
/* Install custom extent hooks. */
|
/* Install custom extent hooks. */
|
||||||
@ -354,7 +354,7 @@ TEST_BEGIN(test_extent_auto_hook)
|
|||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
new_size = sizeof(extent_hooks_t *);
|
new_size = sizeof(extent_hooks_t *);
|
||||||
assert_d_eq(mallctl("arenas.extend", (void *)&arena_ind, &sz,
|
assert_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz,
|
||||||
(void *)&new_hooks, new_size), 0, "Unexpected mallctl() failure");
|
(void *)&new_hooks, new_size), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
test_extent_body(arena_ind);
|
test_extent_body(arena_ind);
|
||||||
|
@ -16,7 +16,7 @@ arena_ind(void)
|
|||||||
|
|
||||||
if (ind == 0) {
|
if (ind == 0) {
|
||||||
size_t sz = sizeof(ind);
|
size_t sz = sizeof(ind);
|
||||||
assert_d_eq(mallctl("arenas.extend", (void *)&ind, &sz, NULL,
|
assert_d_eq(mallctl("arenas.create", (void *)&ind, &sz, NULL,
|
||||||
0), 0, "Unexpected mallctl failure creating arena");
|
0), 0, "Unexpected mallctl failure creating arena");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ TEST_BEGIN(test_arena_reset)
|
|||||||
tsdn_t *tsdn;
|
tsdn_t *tsdn;
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("arenas.extend", (void *)&arena_ind, &sz, NULL, 0),
|
assert_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz, NULL, 0),
|
||||||
0, "Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
|
flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
|
||||||
|
@ -584,14 +584,14 @@ TEST_BEGIN(test_arenas_lextent_constants)
|
|||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_arenas_extend)
|
TEST_BEGIN(test_arenas_create)
|
||||||
{
|
{
|
||||||
unsigned narenas_before, arena, narenas_after;
|
unsigned narenas_before, arena, narenas_after;
|
||||||
size_t sz = sizeof(unsigned);
|
size_t sz = sizeof(unsigned);
|
||||||
|
|
||||||
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas_before, &sz,
|
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas_before, &sz,
|
||||||
NULL, 0), 0, "Unexpected mallctl() failure");
|
NULL, 0), 0, "Unexpected mallctl() failure");
|
||||||
assert_d_eq(mallctl("arenas.extend", (void *)&arena, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.create", (void *)&arena, &sz, NULL, 0), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas_after, &sz, NULL,
|
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas_after, &sz, NULL,
|
||||||
0), 0, "Unexpected mallctl() failure");
|
0), 0, "Unexpected mallctl() failure");
|
||||||
@ -647,6 +647,6 @@ main(void)
|
|||||||
test_arenas_constants,
|
test_arenas_constants,
|
||||||
test_arenas_bin_constants,
|
test_arenas_bin_constants,
|
||||||
test_arenas_lextent_constants,
|
test_arenas_lextent_constants,
|
||||||
test_arenas_extend,
|
test_arenas_create,
|
||||||
test_stats_arenas));
|
test_stats_arenas));
|
||||||
}
|
}
|
||||||
|
@ -68,14 +68,14 @@ nregs_per_run_compute(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
arenas_extend_mallctl(void)
|
arenas_create_mallctl(void)
|
||||||
{
|
{
|
||||||
unsigned arena_ind;
|
unsigned arena_ind;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
sz = sizeof(arena_ind);
|
sz = sizeof(arena_ind);
|
||||||
assert_d_eq(mallctl("arenas.extend", (void *)&arena_ind, &sz, NULL, 0),
|
assert_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz, NULL, 0),
|
||||||
0, "Error in arenas.extend");
|
0, "Error in arenas.create");
|
||||||
|
|
||||||
return (arena_ind);
|
return (arena_ind);
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ arena_reset_mallctl(unsigned arena_ind)
|
|||||||
|
|
||||||
TEST_BEGIN(test_pack)
|
TEST_BEGIN(test_pack)
|
||||||
{
|
{
|
||||||
unsigned arena_ind = arenas_extend_mallctl();
|
unsigned arena_ind = arenas_create_mallctl();
|
||||||
size_t nregs_per_run = nregs_per_run_compute();
|
size_t nregs_per_run = nregs_per_run_compute();
|
||||||
size_t nregs = nregs_per_run * NSLABS;
|
size_t nregs = nregs_per_run * NSLABS;
|
||||||
VARIABLE_ARRAY(void *, ptrs, nregs);
|
VARIABLE_ARRAY(void *, ptrs, nregs);
|
||||||
|
Loading…
Reference in New Issue
Block a user