337-mac80211-increase-quantum-for-airtime-scheduler.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From: Felix Fietkau <[email protected]>
  2. Date: Sun, 26 Jun 2022 11:43:25 +0200
  3. Subject: [PATCH] mac80211: increase quantum for airtime scheduler
  4. Given the typical AQL budget and queue length, a quantum of 256 with the
  5. default station weight often requires iterating over all queues frequently,
  6. until one of them becomes eligible.
  7. Improve performance by using 8 times station weight as scheduler quantum
  8. Signed-off-by: Felix Fietkau <[email protected]>
  9. ---
  10. --- a/net/mac80211/ieee80211_i.h
  11. +++ b/net/mac80211/ieee80211_i.h
  12. @@ -90,6 +90,8 @@ extern const u8 ieee80211_ac_to_qos_mask
  13. */
  14. #define AIRTIME_ACTIVE_DURATION (HZ / 10)
  15. +#define AIRTIME_QUANTUM_SHIFT 3
  16. +
  17. struct ieee80211_bss {
  18. u32 device_ts_beacon, device_ts_presp;
  19. --- a/net/mac80211/tx.c
  20. +++ b/net/mac80211/tx.c
  21. @@ -3895,7 +3895,7 @@ struct ieee80211_txq *ieee80211_next_txq
  22. if (deficit < 0)
  23. sta->airtime[txqi->txq.ac].deficit +=
  24. - sta->airtime_weight;
  25. + sta->airtime_weight << AIRTIME_QUANTUM_SHIFT;
  26. if (deficit < 0 || !aql_check) {
  27. list_move_tail(&txqi->schedule_order,
  28. @@ -4038,7 +4038,8 @@ bool ieee80211_txq_may_transmit(struct i
  29. }
  30. sta = container_of(iter->txq.sta, struct sta_info, sta);
  31. if (ieee80211_sta_deficit(sta, ac) < 0)
  32. - sta->airtime[ac].deficit += sta->airtime_weight;
  33. + sta->airtime[ac].deficit += sta->airtime_weight <<
  34. + AIRTIME_QUANTUM_SHIFT;
  35. list_move_tail(&iter->schedule_order, &local->active_txqs[ac]);
  36. }
  37. @@ -4046,7 +4047,7 @@ bool ieee80211_txq_may_transmit(struct i
  38. if (sta->airtime[ac].deficit >= 0)
  39. goto out;
  40. - sta->airtime[ac].deficit += sta->airtime_weight;
  41. + sta->airtime[ac].deficit += sta->airtime_weight << AIRTIME_QUANTUM_SHIFT;
  42. list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]);
  43. spin_unlock_bh(&local->active_txq_lock[ac]);