diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-07-16 11:48:43 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-07-16 19:24:16 +0200 |
commit | e21b79cb211fa930b79b69ce9416a25816daff47 (patch) | |
tree | 3e661bb6f0f2627db5f10ada20544973c1a7490b | |
parent | f16a069fd7e34c3f94527965073df3bae0e524b1 (diff) |
alloc: Change tx_window optimization strategy
Currently each tx_window combination is checked only once by using a
set containing the sets of TX slots that have been checked already.
This approach does not ensure, that num_tx and ul_ts really match the
tx_window being tested. This does not make a difference with the
current test cases probably because num_tx starts with 1 and is
increased each iteration. Since the bitmap optimization is equivalent
to a cache optimization strategy that only uses tx_window as key. On
the other hand, ul_ts, num_tx, and rx_mask cannot be derived from
tx_window, but these values are also refered to after the call to
test_and_set_bit(). This makes it difficult to prove that correctness
of the caching. While this will not lead to a defect, the results
might be less optimal.
This commit changes the optimization strategy to skip all tx_window
where ul_ts and ul_ts+num_tx-1 are not both contained. This provides
a similar degree of optimization like the set approach (only the
iteration with num_ts == 8 is not optimized, which only applies to to
ms class 18 and 29 MS) but ensures that the values of the related
variables have a clear relationship.
Note that the bitset based optimization for rx_window does not suffer
from a possible cache inconsistency, since only tx_window and
rx_window (tx_slot_count and rx_slot_count can be derived from the
windows and thus are covered by the cache key) are used after the call
to test_and_set_bit(). tx_window is constant over the whole lifetime
of the cache.
Sponsored-by: On-Waves ehf
-rw-r--r-- | src/gprs_rlcmac_ts_alloc.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index d4cd984..ffbbe2b 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -481,8 +481,6 @@ static int find_multi_slots(struct gprs_rlcmac_bts *bts, enum {MASK_TT, MASK_TR}; unsigned mask_sel; - uint32_t checked_tx[256/32] = {0}; - if (ms->ms_class() >= 32) { LOGP(DRLCMAC, LOGL_ERROR, "Multislot class %d out of range.\n", ms->ms_class()); @@ -593,11 +591,12 @@ static int find_multi_slots(struct gprs_rlcmac_bts *bts, /* Filter out unavailable slots */ tx_window &= *ul_slots; - /* Avoid repeated TX combination check */ - if (test_and_set_bit(checked_tx, tx_window)) + /* Skip if the the first TS (ul_ts) is not in the set */ + if ((tx_window & (1 << ul_ts)) == 0) continue; - if (!tx_window) + /* Skip if the the last TS (ul_ts+num_tx-1) is not in the set */ + if ((tx_window & (1 << ((ul_ts+num_tx-1) % 8))) == 0) continue; tx_slot_count = bitcount(tx_window); |