Lines Matching defs:vtime

51  * The device virtual time (vtime) is used as the primary control metric.
73 * A given cgroup's vtime runs slower in inverse proportion to its hweight.
75 * against the device vtime - an IO which takes 10ms on the underlying
79 * vtime is running at a rate determined by its hweight. A cgroup tracks
80 * the vtime consumed by past IOs and can issue a new IO iff doing so
81 * wouldn't outrun the current device vtime. Otherwise, the IO is
82 * suspended until the vtime has progressed enough to cover it.
97 * To slow down, we lower the vrate - the rate at which the device vtime
98 * passes compared to the wall clock. For example, if the vtime is running
144 * snapback mechanism in case the cgroup needs more IO vtime for itself.
147 * accelerating vtime for other cgroups and work conservation can also be
166 * - cur_per : Internal wall and device vtime clock
220 * iocg->vtime is targeted at 50% behind the device vtime, which
222 * immediately canceled if the vtime margin runs below 10%.
239 * As vtime is used to calculate the cost of each IO, it needs to
246 * 1s worth of vtime is 2^37. This gives us both sub-nanosecond
432 u64 period_at_vtime; /* vtime starttime */
497 * `vtime` is this iocg's vtime cursor which progresses as IOs are
498 * issued. If lagging behind device vtime, the delta represents
503 * than issue. The delta behind `vtime` represents the cost of
506 atomic64_t vtime;
516 * and invalidating `vtime`.
653 * vtime credit shortage and down on device saturation.
731 atomic64_add(cost, &iocg->vtime);
949 * When an iocg accumulates too much vtime or gets deactivated, we throw away
950 * some vtime, which lowers the overall device utilization. As the exact amount
952 * vrate accordingly so that the extra vtime generated in the current period
995 * The current vtime is
997 * vtime at period start + (wallclock time since the start) * vrate
1049 iocg->saved_margin = now->vnow - atomic64_read(&iocg->vtime);
1208 u64 vtime, vtarget;
1251 vtime = atomic64_read(&iocg->vtime);
1253 atomic64_add(vtarget - vtime, &iocg->vtime);
1254 atomic64_add(vtarget - vtime, &iocg->done_vtime);
1255 vtime = vtarget;
1269 last_period, cur_period, vtime);
1315 vover = atomic64_read(&iocg->vtime) +
1444 vbudget = now->vnow - atomic64_read(&iocg->vtime);
1454 atomic64_add(vpay, &iocg->vtime);
1475 * Wake up the ones which are due and see how much vtime we'll need for
1581 if (atomic64_read(&iocg->done_vtime) != atomic64_read(&iocg->vtime))
1692 u64 vtime = atomic64_read(&iocg->vtime);
1701 time_after64(vtime, now->vnow - ioc->margins.min))
1705 excess = now->vnow - vtime - ioc->margins.target;
1707 atomic64_add(excess, &iocg->vtime);
1709 vtime += excess;
1729 delta = div64_s64(WEIGHT_ONE * (now->vnow - vtime),
2160 /* might be oversleeping vtime / hweight changes, kick */
2166 u64 vtime = atomic64_read(&iocg->vtime);
2175 excess = now.vnow - vtime - ioc->margins.target;
2200 u64 vdone, vtime, usage_us, usage_dur;
2204 * Collect unused and wind vtime closer to vnow to prevent
2208 vtime = atomic64_read(&iocg->vtime);
2219 time_after64(vtime, vdone) &&
2220 time_after64(vtime, now.vnow -
2232 if (vdone != vtime) {
2234 cost_to_abs_cost(vtime - vdone, hw_inuse),
2250 /* see whether there's surplus vtime */
2254 time_before64(vtime, now.vnow - ioc->margins.low))) {
2296 /* genuinely short on vtime */
2312 * too much IO and should lower vtime rate. If we're not missing
2314 * and should increase vtime rate.
2427 static u64 adjust_inuse_and_calc_cost(struct ioc_gq *iocg, u64 vtime,
2441 margin = now->vnow - vtime - cost;
2477 } while (time_after64(vtime + cost, now->vnow) &&
2569 u64 abs_cost, cost, vtime;
2577 /* calculate the absolute vtime cost */
2586 vtime = atomic64_read(&iocg->vtime);
2587 cost = adjust_inuse_and_calc_cost(iocg, vtime, abs_cost, &now);
2595 time_before_eq64(vtime + cost, now.vnow)) {
2627 * the abs_cost instead of advancing vtime. iocg_kick_waitq() will pay
2631 * actual budget available to the cgroup. If we just wound vtime, we
2665 * current vrate. vtime and hweight changes can make it too short
2704 u64 vtime, abs_cost, cost;
2717 vtime = atomic64_read(&iocg->vtime);
2718 cost = adjust_inuse_and_calc_cost(iocg, vtime, abs_cost, &now);
2726 * Charge if there's enough vtime budget and the existing request has
2730 time_before_eq64(atomic64_read(&iocg->vtime) + cost, now.vnow)) {
2950 atomic64_set(&iocg->vtime, now.vnow);