Re: [PATCH 7/7] blk-iocost: Factor out the base vrate change into a separate function

From: Tejun Heo
Date: Wed Nov 25 2020 - 07:30:41 EST


Hello,

On Tue, Nov 24, 2020 at 11:33:36AM +0800, Baolin Wang wrote:
> @@ -2320,45 +2358,11 @@ static void ioc_timer_fn(struct timer_list *timer)
> ioc->busy_level = clamp(ioc->busy_level, -1000, 1000);
>
> if (ioc->busy_level > 0 || (ioc->busy_level < 0 && !nr_lagging)) {
> - u64 vrate = ioc->vtime_base_rate;
> - u64 vrate_min = ioc->vrate_min, vrate_max = ioc->vrate_max;
...
> + trace_iocost_ioc_vrate_adj(ioc, ioc->vtime_base_rate,
> + missed_ppm, rq_wait_pct,
> nr_lagging, nr_shortages);
> -
> - ioc->vtime_base_rate = vrate;
> - ioc_refresh_margins(ioc);
> } else if (ioc->busy_level != prev_busy_level || nr_lagging) {
> trace_iocost_ioc_vrate_adj(ioc, atomic64_read(&ioc->vtime_rate),
> missed_ppm, rq_wait_pct, nr_lagging,

I think it'd be better to factor out the surrounding if/else block together
(as early exit if blocks). Also, how about ioc_adjust_base_vrate()?

Thanks.

--
tejun