mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 13:53:11 +00:00
Remove batch_alloc mallctl
This commit is contained in:
committed by
Guangli Dai
parent
a5db9feee5
commit
78cbeaf8a4
32
src/ctl.c
32
src/ctl.c
@@ -380,7 +380,6 @@ CTL_PROTO(experimental_arenas_i_pactivep)
|
|||||||
INDEX_PROTO(experimental_arenas_i)
|
INDEX_PROTO(experimental_arenas_i)
|
||||||
CTL_PROTO(experimental_prof_recent_alloc_max)
|
CTL_PROTO(experimental_prof_recent_alloc_max)
|
||||||
CTL_PROTO(experimental_prof_recent_alloc_dump)
|
CTL_PROTO(experimental_prof_recent_alloc_dump)
|
||||||
CTL_PROTO(experimental_batch_alloc)
|
|
||||||
CTL_PROTO(experimental_arenas_create_ext)
|
CTL_PROTO(experimental_arenas_create_ext)
|
||||||
|
|
||||||
#define MUTEX_STATS_CTL_PROTO_GEN(n) \
|
#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("utilization"), CHILD(named, experimental_utilization)},
|
||||||
{NAME("arenas"), CHILD(indexed, experimental_arenas)},
|
{NAME("arenas"), CHILD(indexed, experimental_arenas)},
|
||||||
{NAME("arenas_create_ext"), CTL(experimental_arenas_create_ext)},
|
{NAME("arenas_create_ext"), CTL(experimental_arenas_create_ext)},
|
||||||
{NAME("prof_recent"), CHILD(named, experimental_prof_recent)},
|
{NAME("prof_recent"), CHILD(named, experimental_prof_recent)}};
|
||||||
{NAME("batch_alloc"), CTL(experimental_batch_alloc)}};
|
|
||||||
|
|
||||||
static const ctl_named_node_t root_node[] = {{NAME("version"), CTL(version)},
|
static const ctl_named_node_t root_node[] = {{NAME("version"), CTL(version)},
|
||||||
{NAME("epoch"), CTL(epoch)},
|
{NAME("epoch"), CTL(epoch)},
|
||||||
@@ -4620,34 +4618,6 @@ label_return:
|
|||||||
return ret;
|
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
|
static int
|
||||||
prof_stats_bins_i_live_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
|
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) {
|
void *oldp, size_t *oldlenp, void *newp, size_t newlen) {
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
#include "test/bench.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 10
|
||||||
#define TINY_BATCH_ITER (10 * 1000 * 1000)
|
#define TINY_BATCH_ITER (10 * 1000 * 1000)
|
||||||
#define HUGE_BATCH (1000 * 1000)
|
#define HUGE_BATCH (1000 * 1000)
|
||||||
@@ -17,30 +13,16 @@ static size_t item_ptrs_next = 0;
|
|||||||
|
|
||||||
#define SIZE 7
|
#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
|
static void
|
||||||
batch_alloc_wrapper(size_t batch) {
|
batch_alloc_wrapper(size_t batch) {
|
||||||
batch_alloc_packet_t batch_alloc_packet = {
|
size_t filled = batch_alloc(batch_ptrs + batch_ptrs_next, batch, SIZE, 0);
|
||||||
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, "");
|
|
||||||
assert_zu_eq(filled, batch, "");
|
assert_zu_eq(filled, batch, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
item_alloc_wrapper(size_t batch) {
|
item_alloc_wrapper(size_t batch) {
|
||||||
for (size_t i = item_ptrs_next, end = i + batch; i < end; ++i) {
|
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) {
|
for (size_t i = 0; i < len; ++i) {
|
||||||
void *p = ptrs[i];
|
void *p = ptrs[i];
|
||||||
assert_ptr_not_null(p, "allocation failed");
|
assert_ptr_not_null(p, "allocation failed");
|
||||||
sdallocx(p, SIZE, 0);
|
jet_sdallocx(p, SIZE, 0);
|
||||||
ptrs[i] = NULL;
|
ptrs[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,8 +171,6 @@ TEST_END
|
|||||||
|
|
||||||
int
|
int
|
||||||
main(void) {
|
main(void) {
|
||||||
assert_d_eq(
|
|
||||||
mallctlnametomib("experimental.batch_alloc", mib, &miblen), 0, "");
|
|
||||||
return test_no_reentrancy(test_tiny_batch_without_free,
|
return test_no_reentrancy(test_tiny_batch_without_free,
|
||||||
test_tiny_batch_with_free, test_huge_batch_without_free,
|
test_tiny_batch_with_free, test_huge_batch_without_free,
|
||||||
test_huge_batch_with_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
|
static size_t
|
||||||
batch_alloc_wrapper(void **ptrs, size_t num, size_t size, int flags) {
|
batch_alloc_wrapper(void **ptrs, size_t num, size_t size, int flags) {
|
||||||
batch_alloc_packet_t batch_alloc_packet = {ptrs, num, size, flags};
|
return batch_alloc(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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user