Moved config-related allocations to config_pool and showing its size in memory usage
This commit is contained in:
parent
5aebce5e0c
commit
37b6444137
6 changed files with 14 additions and 10 deletions
|
@ -717,7 +717,7 @@ cf_lex_symbol(const char *data)
|
||||||
static void
|
static void
|
||||||
cf_lex_init_kh(void)
|
cf_lex_init_kh(void)
|
||||||
{
|
{
|
||||||
HASH_INIT(kw_hash, &root_pool, KW_ORDER);
|
HASH_INIT(kw_hash, config_pool, KW_ORDER);
|
||||||
|
|
||||||
struct keyword *k;
|
struct keyword *k;
|
||||||
for (k=keyword_list; k->name; k++)
|
for (k=keyword_list; k->name; k++)
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
static jmp_buf conf_jmpbuf;
|
static jmp_buf conf_jmpbuf;
|
||||||
|
|
||||||
struct config *config, *new_config;
|
struct config *config, *new_config;
|
||||||
|
pool *config_pool;
|
||||||
|
|
||||||
static struct config *old_config; /* Old configuration */
|
static struct config *old_config; /* Old configuration */
|
||||||
static struct config *future_config; /* New config held here if recon requested during recon */
|
static struct config *future_config; /* New config held here if recon requested during recon */
|
||||||
|
@ -89,7 +90,7 @@ int undo_available; /* Undo was not requested from last reconfiguration */
|
||||||
struct config *
|
struct config *
|
||||||
config_alloc(const char *name)
|
config_alloc(const char *name)
|
||||||
{
|
{
|
||||||
pool *p = rp_new(&root_pool, "Config");
|
pool *p = rp_new(config_pool, "Config");
|
||||||
linpool *l = lp_new_default(p);
|
linpool *l = lp_new_default(p);
|
||||||
struct config *c = lp_allocz(l, sizeof(struct config));
|
struct config *c = lp_allocz(l, sizeof(struct config));
|
||||||
|
|
||||||
|
@ -491,10 +492,12 @@ config_timeout(timer *t UNUSED)
|
||||||
void
|
void
|
||||||
config_init(void)
|
config_init(void)
|
||||||
{
|
{
|
||||||
config_event = ev_new(&root_pool);
|
config_pool = rp_new(&root_pool, "Configurations");
|
||||||
|
|
||||||
|
config_event = ev_new(config_pool);
|
||||||
config_event->hook = config_done;
|
config_event->hook = config_done;
|
||||||
|
|
||||||
config_timer = tm_new(&root_pool);
|
config_timer = tm_new(config_pool);
|
||||||
config_timer->hook = config_timeout;
|
config_timer->hook = config_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void order_shutdown(int gr);
|
||||||
|
|
||||||
|
|
||||||
/* Pools */
|
/* Pools */
|
||||||
|
extern pool *config_pool;
|
||||||
extern linpool *cfg_mem;
|
extern linpool *cfg_mem;
|
||||||
|
|
||||||
#define cfg_alloc(size) lp_alloc(cfg_mem, size)
|
#define cfg_alloc(size) lp_alloc(cfg_mem, size)
|
||||||
|
|
|
@ -180,7 +180,7 @@ flow6_opts:
|
||||||
flow_builder_init:
|
flow_builder_init:
|
||||||
{
|
{
|
||||||
if (this_flow == NULL)
|
if (this_flow == NULL)
|
||||||
this_flow = flow_builder_init(&root_pool);
|
this_flow = flow_builder_init(config_pool); /* FIXME: This should be allocated from tmp in future */
|
||||||
else
|
else
|
||||||
flow_builder_clear(this_flow);
|
flow_builder_clear(this_flow);
|
||||||
};
|
};
|
||||||
|
|
|
@ -128,11 +128,11 @@ ca_lookup(pool *p, const char *name, int f_type)
|
||||||
|
|
||||||
static int inited = 0;
|
static int inited = 0;
|
||||||
if (!inited) {
|
if (!inited) {
|
||||||
idm_init(&ca_idm, &root_pool, 8);
|
idm_init(&ca_idm, config_pool, 8);
|
||||||
HASH_INIT(ca_hash, &root_pool, CA_ORDER);
|
HASH_INIT(ca_hash, config_pool, CA_ORDER);
|
||||||
|
|
||||||
ca_storage_max = 256;
|
ca_storage_max = 256;
|
||||||
ca_storage = mb_allocz(&root_pool, sizeof(struct ca_storage *) * ca_storage_max);
|
ca_storage = mb_allocz(config_pool, sizeof(struct ca_storage *) * ca_storage_max);
|
||||||
|
|
||||||
inited++;
|
inited++;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ ca_lookup(pool *p, const char *name, int f_type)
|
||||||
ca_storage = mb_realloc(ca_storage, sizeof(struct ca_storage *) * ca_storage_max * 2);
|
ca_storage = mb_realloc(ca_storage, sizeof(struct ca_storage *) * ca_storage_max * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
cas = mb_allocz(&root_pool, sizeof(struct ca_storage) + strlen(name) + 1);
|
cas = mb_allocz(config_pool, sizeof(struct ca_storage) + strlen(name) + 1);
|
||||||
cas->fda = f_new_dynamic_attr(ea_type, f_type, EA_CUSTOM(id));
|
cas->fda = f_new_dynamic_attr(ea_type, f_type, EA_CUSTOM(id));
|
||||||
cas->uc = 1;
|
cas->uc = 1;
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,7 @@ cmd_show_memory(void)
|
||||||
print_size("Routing tables:", rmemsize(rt_table_pool));
|
print_size("Routing tables:", rmemsize(rt_table_pool));
|
||||||
print_size("Route attributes:", rmemsize(rta_pool));
|
print_size("Route attributes:", rmemsize(rta_pool));
|
||||||
print_size("Protocols:", rmemsize(proto_pool));
|
print_size("Protocols:", rmemsize(proto_pool));
|
||||||
|
print_size("Current config:", rmemsize(config_pool));
|
||||||
struct resmem total = rmemsize(&root_pool);
|
struct resmem total = rmemsize(&root_pool);
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
print_size("Standby memory:", (struct resmem) { .overhead = page_size * *pages_kept });
|
print_size("Standby memory:", (struct resmem) { .overhead = page_size * *pages_kept });
|
||||||
|
|
Loading…
Reference in a new issue