ewma
unsigned int ewma;
ewma = hctx->dispatch_busy;
if (!ewma && !busy)
ewma *= BLK_MQ_DISPATCH_BUSY_EWMA_WEIGHT - 1;
ewma += 1 << BLK_MQ_DISPATCH_BUSY_EWMA_FACTOR;
ewma /= BLK_MQ_DISPATCH_BUSY_EWMA_WEIGHT;
hctx->dispatch_busy = ewma;
#define ewma_add(ewma, val, weight, factor) \
(ewma) *= (weight) - 1; \
(ewma) += (val) << factor; \
(ewma) /= (weight); \
(ewma) >> factor; \
static inline int rt2x00link_get_avg_rssi(struct ewma_rssi *ewma)
avg = ewma_rssi_read(ewma);
unsigned int ewma, dequeued, last_ewma_diff;
ewma = READ_ONCE(p->se.avg.util_est);
if (ewma & UTIL_AVG_UNCHANGED)
if (ewma <= dequeued) {
ewma = dequeued;
last_ewma_diff = ewma - dequeued;
ewma <<= UTIL_EST_WEIGHT_SHIFT;
ewma -= last_ewma_diff;
ewma >>= UTIL_EST_WEIGHT_SHIFT;
ewma |= UTIL_AVG_UNCHANGED;
WRITE_ONCE(p->se.avg.util_est, ewma);
change = ewma(advisor_ctx.change, change);
u32 ewma;
ewma = delivered_pkts << PKTS_ACKED_PREC;
ewma = tp->pkts_acked_ewma;
ewma = (((ewma << PKTS_ACKED_WEIGHT) - ewma) +
tp->pkts_acked_ewma = min_t(u32, ewma, 0xFFFFU);