Lines Matching refs:now

561 	u64				now;  member
963 static void ioc_refresh_vrate(struct ioc *ioc, struct ioc_now *now) in ioc_refresh_vrate() argument
965 s64 pleft = ioc->period_at + ioc->period_us - now->now; in ioc_refresh_vrate()
1042 static void ioc_now(struct ioc *ioc, struct ioc_now *now) in ioc_now() argument
1047 now->now_ns = ktime_get(); in ioc_now()
1048 now->now = ktime_to_us(now->now_ns); in ioc_now()
1061 now->vnow = ioc->period_at_vtime + in ioc_now()
1062 (now->now - ioc->period_at) * vrate; in ioc_now()
1066 static void ioc_start_period(struct ioc *ioc, struct ioc_now *now) in ioc_start_period() argument
1071 ioc->period_at = now->now; in ioc_start_period()
1072 ioc->period_at_vtime = now->vnow; in ioc_start_period()
1085 bool save, struct ioc_now *now) in __propagate_weights() argument
1106 iocg->saved_margin = now->vnow - atomic64_read(&iocg->vtime); in __propagate_weights()
1160 bool save, struct ioc_now *now) in propagate_weights() argument
1162 __propagate_weights(iocg, active, inuse, save, now); in propagate_weights()
1246 static void weight_updated(struct ioc_gq *iocg, struct ioc_now *now) in weight_updated() argument
1257 propagate_weights(iocg, weight, iocg->inuse, true, now); in weight_updated()
1261 static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now) in iocg_activate() argument
1273 ioc_now(ioc, now); in iocg_activate()
1286 ioc_now(ioc, now); in iocg_activate()
1307 vtarget = now->vnow - ioc->margins.target; in iocg_activate()
1323 iocg->last_inuse ?: iocg->weight, true, now); in iocg_activate()
1325 TRACE_IOCG_PATH(iocg_activate, iocg, now, in iocg_activate()
1328 iocg->activated_at = now->now; in iocg_activate()
1332 ioc->dfgv_period_at = now->now; in iocg_activate()
1334 ioc_start_period(ioc, now); in iocg_activate()
1346 static bool iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now) in iocg_kick_delay() argument
1357 tdelta = now->now - iocg->delay_at; in iocg_kick_delay()
1366 abs_cost_to_cost(iocg->abs_vdebt, hwa) - now->vnow; in iocg_kick_delay()
1383 iocg->delay_at = now->now; in iocg_kick_delay()
1389 iocg->indelay_since = now->now; in iocg_kick_delay()
1394 iocg->stat.indelay_us += now->now - iocg->indelay_since; in iocg_kick_delay()
1404 struct ioc_now *now) in iocg_incur_debt() argument
1417 iocg->indebt_since = now->now; in iocg_incur_debt()
1418 propagate_weights(iocg, iocg->active, 0, false, now); in iocg_incur_debt()
1429 struct ioc_now *now) in iocg_pay_debt() argument
1442 iocg->stat.indebt_us += now->now - iocg->indebt_since; in iocg_pay_debt()
1446 false, now); in iocg_pay_debt()
1483 struct ioc_now *now) in iocg_kick_waitq() argument
1494 vbudget = now->vnow - atomic64_read(&iocg->vtime); in iocg_kick_waitq()
1506 iocg_pay_debt(iocg, abs_vpay, now); in iocg_kick_waitq()
1511 iocg_kick_delay(iocg, now); in iocg_kick_waitq()
1536 iocg->stat.wait_us += now->now - iocg->wait_since; in iocg_kick_waitq()
1543 iocg->wait_since = now->now; in iocg_kick_waitq()
1550 expires = now->now_ns + in iocg_kick_waitq()
1569 struct ioc_now now; in iocg_waitq_timer_fn() local
1572 ioc_now(iocg->ioc, &now); in iocg_waitq_timer_fn()
1575 iocg_kick_waitq(iocg, pay_debt, &now); in iocg_waitq_timer_fn()
1685 static void iocg_flush_stat_leaf(struct ioc_gq *iocg, struct ioc_now *now) in iocg_flush_stat_leaf() argument
1709 static void iocg_flush_stat(struct list_head *target_iocgs, struct ioc_now *now) in iocg_flush_stat() argument
1716 iocg_flush_stat_leaf(iocg, now); in iocg_flush_stat()
1733 u32 usage, struct ioc_now *now) in hweight_after_donation() argument
1745 time_after64(vtime, now->vnow - ioc->margins.min)) in hweight_after_donation()
1749 excess = now->vnow - vtime - ioc->margins.target; in hweight_after_donation()
1773 delta = div64_s64(WEIGHT_ONE * (now->vnow - vtime), in hweight_after_donation()
1774 now->vnow - ioc->period_at_vtime); in hweight_after_donation()
1838 static void transfer_surpluses(struct list_head *surpluses, struct ioc_now *now) in transfer_surpluses() argument
2040 TRACE_IOCG_PATH(inuse_transfer, iocg, now, in transfer_surpluses()
2045 __propagate_weights(iocg, iocg->active, inuse, true, now); in transfer_surpluses()
2065 struct ioc_now *now) in ioc_forgive_debts() argument
2072 ioc->dfgv_period_at = now->now; in ioc_forgive_debts()
2088 if (time_before64(now->now, ioc->dfgv_period_at + DFGV_PERIOD)) in ioc_forgive_debts()
2095 dur = now->now - ioc->dfgv_period_at; in ioc_forgive_debts()
2098 ioc->dfgv_period_at = now->now; in ioc_forgive_debts()
2135 iocg_kick_waitq(iocg, true, now); in ioc_forgive_debts()
2137 TRACE_IOCG_PATH(iocg_forgive_debt, iocg, now, usage_pct, in ioc_forgive_debts()
2155 static int ioc_check_iocgs(struct ioc *ioc, struct ioc_now *now) in ioc_check_iocgs() argument
2169 iocg->stat.wait_us += now->now - iocg->wait_since; in ioc_check_iocgs()
2170 iocg->wait_since = now->now; in ioc_check_iocgs()
2174 now->now - iocg->indebt_since; in ioc_check_iocgs()
2175 iocg->indebt_since = now->now; in ioc_check_iocgs()
2179 now->now - iocg->indelay_since; in ioc_check_iocgs()
2180 iocg->indelay_since = now->now; in ioc_check_iocgs()
2186 iocg_kick_waitq(iocg, true, now); in ioc_check_iocgs()
2200 excess = now->vnow - vtime - ioc->margins.target; in ioc_check_iocgs()
2209 TRACE_IOCG_PATH(iocg_idle, iocg, now, in ioc_check_iocgs()
2212 __propagate_weights(iocg, 0, 0, false, now); in ioc_check_iocgs()
2227 struct ioc_now now; in ioc_timer_fn() local
2245 ioc_now(ioc, &now); in ioc_timer_fn()
2247 period_vtime = now.vnow - ioc->period_at_vtime; in ioc_timer_fn()
2253 nr_debtors = ioc_check_iocgs(ioc, &now); in ioc_timer_fn()
2259 iocg_flush_stat(&ioc->active_iocgs, &now); in ioc_timer_fn()
2283 time_after64(vtime, now.vnow - in ioc_timer_fn()
2285 time_before64(vdone, now.vnow - period_vtime)) in ioc_timer_fn()
2299 time_before64(vtime, now.vnow - ioc->margins.low))) { in ioc_timer_fn()
2313 usage_dur = max_t(u64, now.now - iocg->activated_at, 1); in ioc_timer_fn()
2315 usage_dur = max_t(u64, now.now - ioc->period_at, 1); in ioc_timer_fn()
2329 usage, &now); in ioc_timer_fn()
2352 TRACE_IOCG_PATH(inuse_shortage, iocg, &now, in ioc_timer_fn()
2357 iocg->active, true, &now); in ioc_timer_fn()
2367 transfer_surpluses(&surpluses, &now); in ioc_timer_fn()
2426 ioc_forgive_debts(ioc, usage_us_sum, nr_debtors, &now); in ioc_timer_fn()
2436 ioc_start_period(ioc, &now); in ioc_timer_fn()
2443 ioc_refresh_vrate(ioc, &now); in ioc_timer_fn()
2450 u64 abs_cost, struct ioc_now *now) in adjust_inuse_and_calc_cost() argument
2462 margin = now->vnow - vtime - cost; in adjust_inuse_and_calc_cost()
2495 propagate_weights(iocg, iocg->active, new_inuse, true, now); in adjust_inuse_and_calc_cost()
2498 } while (time_after64(vtime + cost, now->vnow) && in adjust_inuse_and_calc_cost()
2503 TRACE_IOCG_PATH(inuse_adjust, iocg, now, in adjust_inuse_and_calc_cost()
2588 struct ioc_now now; in ioc_rqos_throttle() local
2603 if (!iocg_activate(iocg, &now)) in ioc_rqos_throttle()
2608 cost = adjust_inuse_and_calc_cost(iocg, vtime, abs_cost, &now); in ioc_rqos_throttle()
2616 time_before_eq64(vtime + cost, now.vnow)) { in ioc_rqos_throttle()
2664 iocg_incur_debt(iocg, abs_cost, &now); in ioc_rqos_throttle()
2665 if (iocg_kick_delay(iocg, &now)) in ioc_rqos_throttle()
2680 &now); in ioc_rqos_throttle()
2703 iocg_kick_waitq(iocg, ioc_locked, &now); in ioc_rqos_throttle()
2724 struct ioc_now now; in ioc_rqos_merge() local
2736 ioc_now(ioc, &now); in ioc_rqos_merge()
2739 cost = adjust_inuse_and_calc_cost(iocg, vtime, abs_cost, &now); in ioc_rqos_merge()
2751 time_before_eq64(atomic64_read(&iocg->vtime) + cost, now.vnow)) { in ioc_rqos_merge()
2765 iocg_incur_debt(iocg, abs_cost, &now); in ioc_rqos_merge()
2766 if (iocg_kick_delay(iocg, &now)) in ioc_rqos_merge()
2965 struct ioc_now now; in ioc_pd_init() local
2969 ioc_now(ioc, &now); in ioc_pd_init()
2972 atomic64_set(&iocg->vtime, now.vnow); in ioc_pd_init()
2973 atomic64_set(&iocg->done_vtime, now.vnow); in ioc_pd_init()
2993 weight_updated(iocg, &now); in ioc_pd_init()
3007 struct ioc_now now; in ioc_pd_free() local
3009 ioc_now(ioc, &now); in ioc_pd_free()
3010 propagate_weights(iocg, 0, 0, false, &now); in ioc_pd_free()
3078 struct ioc_now now; in ioc_weight_write() local
3099 ioc_now(iocg->ioc, &now); in ioc_weight_write()
3100 weight_updated(iocg, &now); in ioc_weight_write()
3126 ioc_now(iocg->ioc, &now); in ioc_weight_write()
3127 weight_updated(iocg, &now); in ioc_weight_write()