[Asterisk-code-review] core: Disable astobj2 locking for some common objects. (asterisk[15])

George Joseph asteriskteam at digium.com
Wed Oct 3 09:30:41 CDT 2018


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/10392 )

Change subject: core: Disable astobj2 locking for some common objects.
......................................................................

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
---
M main/config_options.c
M main/indications.c
M main/loader.c
M main/media_index.c
M main/xmldoc.c
5 files changed, 17 insertions(+), 7 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/main/config_options.c b/main/config_options.c
index 41c8b22..2d5e09c 100644
--- a/main/config_options.c
+++ b/main/config_options.c
@@ -222,7 +222,8 @@
 		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 @@
 		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;
 	}
 
diff --git a/main/indications.c b/main/indications.c
index 55fac71..93da21c 100644
--- a/main/indications.c
+++ b/main/indications.c
@@ -588,7 +588,9 @@
 	}
 	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;
 	}
 
diff --git a/main/loader.c b/main/loader.c
index c495d76..eef5697 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -231,7 +231,7 @@
 
 	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);
 
diff --git a/main/media_index.c b/main/media_index.c
index 72bc1cc..bfaa580 100644
--- a/main/media_index.c
+++ b/main/media_index.c
@@ -64,7 +64,8 @@
 	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 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;
 	}
diff --git a/main/xmldoc.c b/main/xmldoc.c
index b4649ac..43ae074 100644
--- a/main/xmldoc.c
+++ b/main/xmldoc.c
@@ -2290,7 +2290,9 @@
 {
 	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;
 	}

-- 
To view, visit https://gerrit.asterisk.org/10392
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8
Gerrit-Change-Number: 10392
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181003/2e64844f/attachment.html>


More information about the asterisk-code-review mailing list