Change in libosmocore[master]: add osmo_use_count API

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Mar 5 09:55:34 UTC 2019


Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13121 )

Change subject: add osmo_use_count API
......................................................................


Patch Set 2:

(2 comments)

I don't want to discourage you, but I cannot help if something less generic might be upt to the task.  This quickly unfolds in tons of heap allocations and even more linear list traversals than I would normally like to see.

Wouldn't it also be an otpion to have a limited set (array) of 'entry' inside the use count itself?  That way we can avoid dynamic  allocations for every 'entry' and the linear list iterations on lookup.  And since the use_counter and all of its entries are then one big structure, that one could actually be statically part of a larger object of the user, avoiding any heap allocations at all?

If you don't think it's possible to make a good fixed guess on the number of 'entries' (use counter buckets/classes is what I'd call them), then one could still make a compromise:  use a [0] sized array at the end of the counter, and once you allocate the counter, you pass in the number of entries/classes/buckets that shall be allocated as part of the counter?  That way we have dynamic number of entries at the expense of one heap allocation for the entire use_count?

https://gerrit.osmocom.org/#/c/13121/2/include/osmocom/core/use_count.h
File include/osmocom/core/use_count.h:

https://gerrit.osmocom.org/#/c/13121/2/include/osmocom/core/use_count.h@133
PS2, Line 133: talloc_object
naming issue: this is basically just some opaque void * pointer, right?  If nothing in the libosmocore use_count implementation actually treats this as 'talloc' object or context, then we should just call it 'priv', 'data', or 'user data'.  Uers may then choose to store a talloc context or whatever else they may want to store.


https://gerrit.osmocom.org/#/c/13121/2/include/osmocom/core/use_count.h@150
PS2, Line 150: count
I think it's rather difficult to understand that a given "entry" or "token" can have multiple "counts".  I understand that it's something that's handy in the context of osmo-msc and the "multiple CM service requests".



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ife31e6798b4e728a23913179e346552a7dd338c0
Gerrit-Change-Number: 13121
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-CC: Harald Welte <laforge at gnumonks.org>
Gerrit-Comment-Date: Tue, 05 Mar 2019 09:55:34 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190305/2e361338/attachment.htm>


More information about the gerrit-log mailing list