core: Disable astobj2 locking for some common objects.

* ACO options
* Indications
* Module loader ref_debug object
* Media index info and variants
* xmldoc items

These allocation locations were identified using reflocks.py on the
master branch.

Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8
pull/11/head
Corey Farrell 7 years ago
parent 686ba0f869
commit cacbe32534
No known key found for this signature in database
GPG Key ID: D1B6E98EB07F7F6C

@ -222,7 +222,8 @@ int aco_option_register_deprecated(struct aco_info *info, const char *name, stru
return -1;
}
if (!(opt = ao2_alloc(sizeof(*opt), config_option_destroy))) {
opt = ao2_alloc_options(sizeof(*opt), config_option_destroy, AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!opt) {
return -1;
}
@ -313,7 +314,9 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc
return -1;
}
if (!(opt = ao2_alloc(sizeof(*opt) + argc * sizeof(opt->args[0]), config_option_destroy))) {
opt = ao2_alloc_options(sizeof(*opt) + argc * sizeof(opt->args[0]),
config_option_destroy, AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!opt) {
return -1;
}

@ -588,7 +588,9 @@ static int ast_register_indication(struct ast_tone_zone *zone, const char *indic
}
AST_LIST_TRAVERSE_SAFE_END;
if (!(ts = ao2_alloc(sizeof(*ts), ast_tone_zone_sound_destructor))) {
ts = ao2_alloc_options(sizeof(*ts), ast_tone_zone_sound_destructor,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!ts) {
return -1;
}

@ -554,7 +554,7 @@ void ast_module_register(const struct ast_module_info *info)
mod->info = info;
if (ast_opt_ref_debug) {
mod->ref_debug = ao2_t_alloc(0, NULL, info->name);
mod->ref_debug = ao2_t_alloc_options(0, NULL, AO2_ALLOC_OPT_LOCK_NOLOCK, info->name);
}
AST_LIST_HEAD_INIT(&mod->users);
AST_VECTOR_INIT(&mod->requires, 0);

@ -64,7 +64,8 @@ static struct media_variant *media_variant_alloc(const char *variant_str)
size_t str_sz = strlen(variant_str) + 1;
struct media_variant *variant;
variant = ao2_alloc(sizeof(*variant) + str_sz, media_variant_destroy);
variant = ao2_alloc_options(sizeof(*variant) + str_sz, media_variant_destroy,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!variant) {
return NULL;
}
@ -110,8 +111,10 @@ static void media_info_destroy(void *obj)
static struct media_info *media_info_alloc(const char *name)
{
size_t name_sz = strlen(name) + 1;
struct media_info *info = ao2_alloc(sizeof(*info) + name_sz, media_info_destroy);
struct media_info *info;
info = ao2_alloc_options(sizeof(*info) + name_sz, media_info_destroy,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!info) {
return NULL;
}

@ -2290,7 +2290,9 @@ static struct ast_xml_doc_item *ast_xml_doc_item_alloc(const char *name, const c
{
struct ast_xml_doc_item *item;
if (!(item = ao2_alloc(sizeof(*item), ast_xml_doc_item_destructor))) {
item = ao2_alloc_options(sizeof(*item), ast_xml_doc_item_destructor,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!item) {
ast_log(AST_LOG_ERROR, "Failed to allocate memory for ast_xml_doc_item instance\n");
return NULL;
}

Loading…
Cancel
Save