MT#55283 add static_bufferpool

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

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

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

@ -82,6 +82,7 @@ static GQueue rtpe_cli = G_QUEUE_INIT;
GQueue rtpe_control_ng = G_QUEUE_INIT; GQueue rtpe_control_ng = G_QUEUE_INIT;
GQueue rtpe_control_ng_tcp = G_QUEUE_INIT; GQueue rtpe_control_ng_tcp = G_QUEUE_INIT;
struct bufferpool *shm_bufferpool; struct bufferpool *shm_bufferpool;
struct bufferpool *static_bufferpool;
struct bufferpool *rtpe_bufferpool; struct bufferpool *rtpe_bufferpool;
memory_arena_t rtpe_arena; memory_arena_t rtpe_arena;
@ -1611,7 +1612,9 @@ static void kernel_setup(void) {
return; return;
fallback: 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 #endif
ng_client_cleanup(); ng_client_cleanup();
bufferpool_destroy(shm_bufferpool); bufferpool_destroy(shm_bufferpool);
bufferpool_destroy(static_bufferpool);
kernel_shutdown_table(); kernel_shutdown_table();
options_free(); options_free();
bufferpool_cleanup(); 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->advertised_address = ifa->advertised_address;
ifc->spec = spec; ifc->spec = spec;
ifc->logical = lif; 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); 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, "main", rtpe_bufferpool);
bpool_stats(ret, "shared", shm_bufferpool); bpool_stats(ret, "shared", shm_bufferpool);
bpool_stats(ret, "static", static_bufferpool);
HEADER("}", NULL); 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) { void statistics_init(void) {
rtpe_started = now_us(); 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); mutex_init(&rtpe_codec_stats_lock);
rtpe_codec_stats = codec_stats_ht_new(); rtpe_codec_stats = codec_stats_ht_new();

@ -334,6 +334,7 @@ extern GQueue rtpe_control_ng;
extern GQueue rtpe_control_ng_tcp; extern GQueue rtpe_control_ng_tcp;
extern struct bufferpool *shm_bufferpool; extern struct bufferpool *shm_bufferpool;
extern struct bufferpool *static_bufferpool;
extern struct bufferpool *rtpe_bufferpool; extern struct bufferpool *rtpe_bufferpool;
extern memory_arena_t rtpe_arena; 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; __thread struct bufferpool *media_bufferpool;
void append_thread_lpr_to_glob_lpr(void) {} void append_thread_lpr_to_glob_lpr(void) {}
struct bufferpool *shm_bufferpool; struct bufferpool *shm_bufferpool;
struct bufferpool *static_bufferpool;
int get_local_log_level(unsigned int u) { int get_local_log_level(unsigned int u) {
return -1; return -1;

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

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

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

Loading…
Cancel
Save