mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-30 00:27:30 +03:00
Remove batch_alloc mallctl
This commit is contained in:
parent
a5db9feee5
commit
78cbeaf8a4
3 changed files with 5 additions and 69 deletions
32
src/ctl.c
32
src/ctl.c
|
|
@ -380,7 +380,6 @@ CTL_PROTO(experimental_arenas_i_pactivep)
|
|||
INDEX_PROTO(experimental_arenas_i)
|
||||
CTL_PROTO(experimental_prof_recent_alloc_max)
|
||||
CTL_PROTO(experimental_prof_recent_alloc_dump)
|
||||
CTL_PROTO(experimental_batch_alloc)
|
||||
CTL_PROTO(experimental_arenas_create_ext)
|
||||
|
||||
#define MUTEX_STATS_CTL_PROTO_GEN(n) \
|
||||
|
|
@ -940,8 +939,7 @@ static const ctl_named_node_t experimental_node[] = {
|
|||
{NAME("utilization"), CHILD(named, experimental_utilization)},
|
||||
{NAME("arenas"), CHILD(indexed, experimental_arenas)},
|
||||
{NAME("arenas_create_ext"), CTL(experimental_arenas_create_ext)},
|
||||
{NAME("prof_recent"), CHILD(named, experimental_prof_recent)},
|
||||
{NAME("batch_alloc"), CTL(experimental_batch_alloc)}};
|
||||
{NAME("prof_recent"), CHILD(named, experimental_prof_recent)}};
|
||||
|
||||
static const ctl_named_node_t root_node[] = {{NAME("version"), CTL(version)},
|
||||
{NAME("epoch"), CTL(epoch)},
|
||||
|
|
@ -4620,34 +4618,6 @@ label_return:
|
|||
return ret;
|
||||
}
|
||||
|
||||
typedef struct batch_alloc_packet_s batch_alloc_packet_t;
|
||||
struct batch_alloc_packet_s {
|
||||
void **ptrs;
|
||||
size_t num;
|
||||
size_t size;
|
||||
int flags;
|
||||
};
|
||||
|
||||
static int
|
||||
experimental_batch_alloc_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
|
||||
void *oldp, size_t *oldlenp, void *newp, size_t newlen) {
|
||||
int ret;
|
||||
|
||||
VERIFY_READ(size_t);
|
||||
|
||||
batch_alloc_packet_t batch_alloc_packet;
|
||||
ASSURED_WRITE(batch_alloc_packet, batch_alloc_packet_t);
|
||||
size_t filled = batch_alloc(batch_alloc_packet.ptrs,
|
||||
batch_alloc_packet.num, batch_alloc_packet.size,
|
||||
batch_alloc_packet.flags);
|
||||
READ(filled, size_t);
|
||||
|
||||
ret = 0;
|
||||
|
||||
label_return:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
prof_stats_bins_i_live_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
|
||||
void *oldp, size_t *oldlenp, void *newp, size_t newlen) {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
#include "test/bench.h"
|
||||
|
||||
#define MIBLEN 8
|
||||
static size_t mib[MIBLEN];
|
||||
static size_t miblen = MIBLEN;
|
||||
|
||||
#define TINY_BATCH 10
|
||||
#define TINY_BATCH_ITER (10 * 1000 * 1000)
|
||||
#define HUGE_BATCH (1000 * 1000)
|
||||
|
|
@ -17,30 +13,16 @@ static size_t item_ptrs_next = 0;
|
|||
|
||||
#define SIZE 7
|
||||
|
||||
typedef struct batch_alloc_packet_s batch_alloc_packet_t;
|
||||
struct batch_alloc_packet_s {
|
||||
void **ptrs;
|
||||
size_t num;
|
||||
size_t size;
|
||||
int flags;
|
||||
};
|
||||
|
||||
static void
|
||||
batch_alloc_wrapper(size_t batch) {
|
||||
batch_alloc_packet_t batch_alloc_packet = {
|
||||
batch_ptrs + batch_ptrs_next, batch, SIZE, 0};
|
||||
size_t filled;
|
||||
size_t len = sizeof(size_t);
|
||||
assert_d_eq(mallctlbymib(mib, miblen, &filled, &len,
|
||||
&batch_alloc_packet, sizeof(batch_alloc_packet)),
|
||||
0, "");
|
||||
size_t filled = batch_alloc(batch_ptrs + batch_ptrs_next, batch, SIZE, 0);
|
||||
assert_zu_eq(filled, batch, "");
|
||||
}
|
||||
|
||||
static void
|
||||
item_alloc_wrapper(size_t batch) {
|
||||
for (size_t i = item_ptrs_next, end = i + batch; i < end; ++i) {
|
||||
item_ptrs[i] = malloc(SIZE);
|
||||
item_ptrs[i] = jet_malloc(SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +31,7 @@ release_and_clear(void **ptrs, size_t len) {
|
|||
for (size_t i = 0; i < len; ++i) {
|
||||
void *p = ptrs[i];
|
||||
assert_ptr_not_null(p, "allocation failed");
|
||||
sdallocx(p, SIZE, 0);
|
||||
jet_sdallocx(p, SIZE, 0);
|
||||
ptrs[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -189,8 +171,6 @@ TEST_END
|
|||
|
||||
int
|
||||
main(void) {
|
||||
assert_d_eq(
|
||||
mallctlnametomib("experimental.batch_alloc", mib, &miblen), 0, "");
|
||||
return test_no_reentrancy(test_tiny_batch_without_free,
|
||||
test_tiny_batch_with_free, test_huge_batch_without_free,
|
||||
test_huge_batch_with_free);
|
||||
|
|
|
|||
|
|
@ -58,23 +58,9 @@ release_batch(void **ptrs, size_t batch, size_t size) {
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct batch_alloc_packet_s batch_alloc_packet_t;
|
||||
struct batch_alloc_packet_s {
|
||||
void **ptrs;
|
||||
size_t num;
|
||||
size_t size;
|
||||
int flags;
|
||||
};
|
||||
|
||||
static size_t
|
||||
batch_alloc_wrapper(void **ptrs, size_t num, size_t size, int flags) {
|
||||
batch_alloc_packet_t batch_alloc_packet = {ptrs, num, size, flags};
|
||||
size_t filled;
|
||||
size_t len = sizeof(size_t);
|
||||
assert_d_eq(mallctl("experimental.batch_alloc", &filled, &len,
|
||||
&batch_alloc_packet, sizeof(batch_alloc_packet)),
|
||||
0, "");
|
||||
return filled;
|
||||
return batch_alloc(ptrs, num, size, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue