Re: [PATCH 04/11] blk-throttle: correct calculation of wait time in tg_may_dispatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 23, 2022 at 02:03:54PM +0800, Kemeng Shi wrote:
> If bps and iops both reach limit, we always return bps wait time as
> tg_within_iops_limit is after "tg_within_bps_limit(tg, bio, bps_limit) &&"
> and will not be called if tg_within_bps_limit return true.

Maybe it's obvious but it'd be better to explain "why" this change is being
made.

> @@ -939,8 +926,9 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio,
>  				jiffies + tg->td->throtl_slice);
>  	}
>  
> -	if (tg_within_bps_limit(tg, bio, bps_limit, &bps_wait) &&
> -	    tg_within_iops_limit(tg, bio, iops_limit, &iops_wait)) {
> +	bps_wait = tg_within_bps_limit(tg, bio, bps_limit);
> +	iops_wait = tg_within_iops_limit(tg, bio, iops_limit);
> +	if (bps_wait + iops_wait == 0) {
>  		if (wait)
>  			*wait = 0;
>  		return true;

So, max_wait is supposed to be maximum in the whole traversal path in the
tree, not just the max value in this tg, so after this, the code should be
changed to sth like the following, right?

        max_wait = max(max, max(bps_wait, iops_wait));

Thanks.

-- 
tejun



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux