1 comment:
Patchset:
Quoting from the "Depends" libosmocore patch discussion:
For this one, my aim was to say that osmo-trx is doing it that way, not that you > should do it that way.
oh, misunderstanding.
If you plan on keep the mutex locked while you gather counters from nft
in this patch:
the stats lock is held while updating the rate_ctrs only, locking only *after* the nft command has run and returned the complete response in a char buffer.
I expect running through that buffer to be very fast, so i lock stats reporting once all around the buffer parsing. If it turns out wrong, we can unlock and re-lock the mutex after every N items (or every N ms?), which would remove "all" blocking of stats. (It is important to keep counters for each HNB in sync, but not important to keep HNBs in sync with each other.)
I expect buffer parsing to already be imperceptibly fast; this is O(n) of pure pointer arithmetic, no syscalls.
most probably blocking the main thread also for the same amount of time.
(I've written this before in different places, but allow me to re-post, to make sure it is mentioned here:)
Blocking of the main thread can happen with this patch, at the times when the main thread wants to run a quick nft command.
This happens only at HNBAP HNB Register and Deregister, i.e. when a hNodeB shows up or disappears; to set up / remove nft counter rules. Here the main thread may have to wait for the second thread querying the counters from nftables. There is an ascii art of it in this patch.
To circumvent this blocking, an inter-thread queue can be introduced to tell the second thread to carry out the nft commands the main thread wants to run.
This is not implemented in this patch on purpose, because:
The HNB Register / Deregister are rare events, and reading counters doesn't really take all that long, either. It may well turn out to be overkill to even have a thread for nftables in the first place. It is slow for large numbers of items, but counters for under 1000 HNB from nft should be fast.
To view, visit change 36540. To unsubscribe, or for help writing mail filters, visit settings.