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
This commit is contained in:
parent
f16a069fd7
commit
e21b79cb21
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue