Re: [PATCH 7/8] blk-iocost: Remove redundant initialization of struct ioc_gq

From: Tejun Heo
Date: Mon Oct 17 2022 - 15:16:38 EST


On Mon, Oct 17, 2022 at 10:00:10AM +0800, Kemeng Shi wrote:
> Some member of struct ioc_gq will not be accessed before it's
> first activation and will be initialized again in it's first
> activation after ioc_pd_init. To be more specific:
> 1)Member iocg->vtime and iocg->done_vtime will set to target in
> activation which only expects vtime is equal to done_vtime in
> first activation.
> 2)Member iocg->active_period will be set with ioc->cur_period
> again in first activation.
>
> Remove the redundant initialization to improve ioc_pd_init a
> littile bit.
>
> The parameter now of weight_updated will not be used if iocg is
> not active, so pass NULL to weight_update here is safe and we
> can remove call to ioc_now.

This isn't a meaningful optimization and makes the code fragile for no
practical gain. Let's not do this.

Thanks.

--
tejun