MT#55283 add static_bufferpool

Separate bufferpool for objects expected to last for the lifetime of the
service

Change-Id: I5325c21cb7d4fc5dbf8a90f239eb26804568bd2f
master
Richard Fuchs 2 days ago
parent 92ae6a2dec
commit 23299afcc1

@ -189,6 +189,7 @@ bool kernel_setup_table(unsigned int id) {
kernel.is_open = true;
shm_bufferpool = bufferpool_new(kernel_alloc, kernel_free);
static_bufferpool = bufferpool_new(kernel_alloc, kernel_free);
return true;
}

@ -82,6 +82,7 @@ static GQueue rtpe_cli = G_QUEUE_INIT;
GQueue rtpe_control_ng = G_QUEUE_INIT;
GQueue rtpe_control_ng_tcp = G_QUEUE_INIT;
struct bufferpool *shm_bufferpool;
struct bufferpool *static_bufferpool;
struct bufferpool *rtpe_bufferpool;
memory_arena_t rtpe_arena;
@ -1611,7 +1612,9 @@ static void kernel_setup(void) {
return;
fallback:
shm_bufferpool = bufferpool_new(bufferpool_aligned_alloc, bufferpool_aligned_free); // fallback userspace bufferpool
// fallback userspace bufferpool
shm_bufferpool = bufferpool_new(bufferpool_aligned_alloc, bufferpool_aligned_free);
static_bufferpool = bufferpool_new(bufferpool_aligned_alloc, bufferpool_aligned_free);
}
@ -2046,6 +2049,7 @@ int main(int argc, char **argv) {
#endif
ng_client_cleanup();
bufferpool_destroy(shm_bufferpool);
bufferpool_destroy(static_bufferpool);
kernel_shutdown_table();
options_free();
bufferpool_cleanup();

@ -988,7 +988,7 @@ static void __interface_append(struct intf_config *ifa, sockfamily_t *fam, bool
ifc->advertised_address = ifa->advertised_address;
ifc->spec = spec;
ifc->logical = lif;
ifc->stats = bufferpool_alloc0(shm_bufferpool, sizeof(*ifc->stats));
ifc->stats = bufferpool_alloc0(static_bufferpool, sizeof(*ifc->stats));
t_queue_push_tail(&all_local_interfaces, ifc);

@ -963,6 +963,7 @@ stats_metric_q *statistics_gather_metrics(struct interface_sampled_rate_stats *i
bpool_stats(ret, "main", rtpe_bufferpool);
bpool_stats(ret, "shared", shm_bufferpool);
bpool_stats(ret, "static", static_bufferpool);
HEADER("}", NULL);
@ -1003,7 +1004,7 @@ TYPED_GHASHTABLE_IMPL(codec_stats_ht, c_str_hash, c_str_equal, NULL, codec_stats
void statistics_init(void) {
rtpe_started = now_us();
rtpe_stats = bufferpool_alloc0(shm_bufferpool, sizeof(*rtpe_stats));
rtpe_stats = bufferpool_alloc0(static_bufferpool, sizeof(*rtpe_stats));
mutex_init(&rtpe_codec_stats_lock);
rtpe_codec_stats = codec_stats_ht_new();

@ -334,6 +334,7 @@ extern GQueue rtpe_control_ng;
extern GQueue rtpe_control_ng_tcp;
extern struct bufferpool *shm_bufferpool;
extern struct bufferpool *static_bufferpool;
extern struct bufferpool *rtpe_bufferpool;
extern memory_arena_t rtpe_arena;

@ -18,6 +18,7 @@ struct global_sampled_min_max rtpe_sampled_graphite_min_max_sampled;
__thread struct bufferpool *media_bufferpool;
void append_thread_lpr_to_glob_lpr(void) {}
struct bufferpool *shm_bufferpool;
struct bufferpool *static_bufferpool;
int get_local_log_level(unsigned int u) {
return -1;

@ -18,6 +18,7 @@ struct global_sampled_min_max rtpe_sampled_graphite_min_max_sampled;
__thread struct bufferpool *media_bufferpool;
void append_thread_lpr_to_glob_lpr(void) {}
struct bufferpool *shm_bufferpool;
struct bufferpool *static_bufferpool;
static void most_cmp(struct payload_tracker *t, const char *cmp, const char *file, int line) {
char buf[1024] = "";

@ -27,6 +27,7 @@ unsigned int rtpe_poller_rr_iter;
GString *dtmf_logs;
GQueue rtpe_control_ng = G_QUEUE_INIT;
struct bufferpool *shm_bufferpool;
struct bufferpool *static_bufferpool;
struct bufferpool *rtpe_bufferpool;
memory_arena_t rtpe_arena;
@ -72,6 +73,7 @@ int main(void) {
rtpe_common_config_ptr = &rtpe_config.common;
bufferpool_init();
shm_bufferpool = bufferpool_new(bufferpool_aligned_alloc, bufferpool_aligned_free);
static_bufferpool = bufferpool_new(bufferpool_aligned_alloc, bufferpool_aligned_free);
endpoint_parse_any(&rtpe_config.graphite_ep, "1.2.3.4:4567");
@ -1398,6 +1400,14 @@ int main(void) {
"shared\n"
"{\n"
"num_shards\n"
"0\n"
"shards\n"
"[\n"
"]\n"
"}\n"
"static\n"
"{\n"
"num_shards\n"
"1\n"
"shards\n"
"[\n"
@ -2729,6 +2739,14 @@ int main(void) {
"shared\n"
"{\n"
"num_shards\n"
"0\n"
"shards\n"
"[\n"
"]\n"
"}\n"
"static\n"
"{\n"
"num_shards\n"
"1\n"
"shards\n"
"[\n"
@ -4057,6 +4075,14 @@ int main(void) {
"shared\n"
"{\n"
"num_shards\n"
"0\n"
"shards\n"
"[\n"
"]\n"
"}\n"
"static\n"
"{\n"
"num_shards\n"
"1\n"
"shards\n"
"[\n"
@ -5404,6 +5430,14 @@ int main(void) {
"shared\n"
"{\n"
"num_shards\n"
"0\n"
"shards\n"
"[\n"
"]\n"
"}\n"
"static\n"
"{\n"
"num_shards\n"
"1\n"
"shards\n"
"[\n"
@ -6740,6 +6774,14 @@ int main(void) {
"shared\n"
"{\n"
"num_shards\n"
"0\n"
"shards\n"
"[\n"
"]\n"
"}\n"
"static\n"
"{\n"
"num_shards\n"
"1\n"
"shards\n"
"[\n"
@ -8070,6 +8112,14 @@ int main(void) {
"shared\n"
"{\n"
"num_shards\n"
"0\n"
"shards\n"
"[\n"
"]\n"
"}\n"
"static\n"
"{\n"
"num_shards\n"
"1\n"
"shards\n"
"[\n"
@ -9403,6 +9453,14 @@ int main(void) {
"shared\n"
"{\n"
"num_shards\n"
"0\n"
"shards\n"
"[\n"
"]\n"
"}\n"
"static\n"
"{\n"
"num_shards\n"
"1\n"
"shards\n"
"[\n"
@ -9429,6 +9487,7 @@ int main(void) {
dtls_cert_free();
ice_free();
bufferpool_destroy(shm_bufferpool);
bufferpool_destroy(static_bufferpool);
call_memory_arena_release();
bufferpool_cleanup();

@ -22,6 +22,7 @@ unsigned int rtpe_poller_rr_iter;
GString *dtmf_logs;
GQueue rtpe_control_ng = G_QUEUE_INIT;
struct bufferpool *shm_bufferpool;
struct bufferpool *static_bufferpool;
struct bufferpool *rtpe_bufferpool;
memory_arena_t rtpe_arena;
@ -440,6 +441,7 @@ int main(void) {
bufferpool_init();
media_bufferpool = bufferpool_new(bufferpool_aligned_alloc, bufferpool_aligned_free);
shm_bufferpool = bufferpool_new(bufferpool_aligned_alloc, bufferpool_aligned_free);
static_bufferpool = bufferpool_new(bufferpool_aligned_alloc, bufferpool_aligned_free);
unsigned long random_seed = 0;
@ -1748,6 +1750,7 @@ int main(void) {
statistics_free();
bufferpool_destroy(media_bufferpool);
bufferpool_destroy(shm_bufferpool);
bufferpool_destroy(static_bufferpool);
bufferpool_cleanup();
return 0;

Loading…
Cancel
Save