diff --git a/daemon/kernel.c b/daemon/kernel.c index 6877061c0..5cb251a48 100644 --- a/daemon/kernel.c +++ b/daemon/kernel.c @@ -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; } diff --git a/daemon/main.c b/daemon/main.c index d0bf361ec..270553af7 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -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(); diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 677cb022d..ab02eaf93 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -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); diff --git a/daemon/statistics.c b/daemon/statistics.c index bce75d511..79e8b5a27 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -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(); diff --git a/include/main.h b/include/main.h index d6957304d..4d1b01f30 100644 --- a/include/main.h +++ b/include/main.h @@ -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; diff --git a/t/test-mix-buffer.c b/t/test-mix-buffer.c index 0f405d17f..d24875000 100644 --- a/t/test-mix-buffer.c +++ b/t/test-mix-buffer.c @@ -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; diff --git a/t/test-payload-tracker.c b/t/test-payload-tracker.c index 8271de769..93ce0d99a 100644 --- a/t/test-payload-tracker.c +++ b/t/test-payload-tracker.c @@ -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] = ""; diff --git a/t/test-stats.c b/t/test-stats.c index 252d4913f..f04c30e7a 100644 --- a/t/test-stats.c +++ b/t/test-stats.c @@ -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(); diff --git a/t/test-transcode.c b/t/test-transcode.c index 49fbab8dc..d9229f0c1 100644 --- a/t/test-transcode.c +++ b/t/test-transcode.c @@ -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;