diff options
author | Harald Welte <laforge@gnumonks.org> | 2015-12-06 21:31:39 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-12-06 21:31:39 +0100 |
commit | 2ecbf871301cdc36c0212dd7526fc94ffa4597d1 (patch) | |
tree | a44c8647e8336c93da3258a8f16a7adba57a85db /src | |
parent | 62d7502b82cbe56211bcd4aa3a363757650fced3 (diff) |
use talloc pool for msgb and ortp library
by using a talloc pool, we avoid having to go back to the libc
malloc pool all the time. The msgb allocations and libortp allocations
happen quite frequently during processing and show up as one of the
high priority items in osmo-bts profiles on sysmoBTS with 14 concurrent
TCH/H calls (highest load scenario).
talloc still consumes significant CPU, this is mostly due to the
zero-initialization of all the associated buffers. Strictly speaking
we shouldn't need this, but any change there would require lots of
testing, as there might be hidden assumptions in the code?
In some percentage of cases, talloc still seems to fall back on malloc
for msgb allocations, which is currently a bit of a mystery. The pools
certainly are large enough, talloc_reprt() rarely reports more than a
few tens of kilobytes used by the msgb pool.
Diffstat (limited to 'src')
-rw-r--r-- | src/common/bts.c | 6 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/main.c | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/common/bts.c b/src/common/bts.c index 3fa2bddc..e0a8a07e 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -78,6 +78,7 @@ int bts_init(struct gsm_bts *bts) struct gsm_bts_trx *trx; int rc; static int initialized = 0; + void *tall_rtp_ctx; /* add to list of BTSs */ llist_add_tail(&bts->list, &bts_gsmnet.bts_list); @@ -142,7 +143,10 @@ int bts_init(struct gsm_bts *bts) tpp->ramp.step_interval_sec = 1; } - osmo_rtp_init(tall_bts_ctx); + /* allocate a talloc pool for ORTP to ensure it doesn't have to go back + * to the libc malloc all the time */ + tall_rtp_ctx = talloc_pool(tall_bts_ctx, 262144); + osmo_rtp_init(tall_rtp_ctx); rc = bts_model_init(bts); if (rc < 0) { diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c index 0b2b9ff3..9984e3cf 100644 --- a/src/osmo-bts-sysmo/main.c +++ b/src/osmo-bts-sysmo/main.c @@ -312,7 +312,7 @@ int main(int argc, char **argv) int rc; tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context"); - tall_msgb_ctx = talloc_named_const(tall_bts_ctx, 1, "msgb"); + tall_msgb_ctx = talloc_pool(tall_bts_ctx, 100*1024); msgb_set_talloc_ctx(tall_msgb_ctx); bts_log_init(NULL); |