cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Kemeng Shi <shikemeng@huawei.com>
Cc: josef@toxicpanda.com, axboe@kernel.dk, cgroups@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 04/10] blk-throttle: correct calculation of wait time in tg_may_dispatch
Date: Wed, 30 Nov 2022 11:27:21 -1000	[thread overview]
Message-ID: <Y4fKuZPlfhf3+eUt@slm.duckdns.org> (raw)
In-Reply-To: <20221129030147.27400-5-shikemeng@huawei.com>

On Tue, Nov 29, 2022 at 11:01:41AM +0800, Kemeng Shi wrote:
> In C language, When executing "if (expression1 && expression2)" and
> expression1 return false, the expression2 may not be executed.
> For "tg_within_bps_limit(tg, bio, bps_limit, &bps_wait) &&
> tg_within_iops_limit(tg, bio, iops_limit, &iops_wait))", if bps is
> limited, tg_within_bps_limit will return false and
> tg_within_iops_limit will not be called. So even bps and iops are
> both limited, iops_wait will not be calculated and is always zero.
> So wait time of iops is always ignored.
> 
> Fix this by always calling tg_within_bps_limit and tg_within_iops_limit
> to get wait time for both bps and iops.
> 
> Observed that:
> 1. Wait time in tg_within_iops_limit/tg_within_bps_limit need always
> be stored as wait argument is always passed.
> 2. wait time is stored to zero if iops/bps is limited otherwise non-zero
> is stored.
> Simpfy tg_within_iops_limit/tg_within_bps_limit by removing wait argument
> and return wait time directly. Caller tg_may_dispatch checks if wait time
> is zero to find if iops/bps is limited.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huawei.com>

Acked-by: Tejun Heo <tj@kernel.org>

-- 
tejun

  reply	other threads:[~2022-11-30 21:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29  3:01 [PATCH v2 00/10] A few bugfix and cleanup patches for blk-throttle Kemeng Shi
2022-11-29  3:01 ` [PATCH v2 01/10] blk-throttle: correct stale comment in throtl_pd_init Kemeng Shi
2022-11-30 21:08   ` Tejun Heo
2022-11-29  3:01 ` [PATCH v2 04/10] blk-throttle: correct calculation of wait time in tg_may_dispatch Kemeng Shi
2022-11-30 21:27   ` Tejun Heo [this message]
     [not found] ` <20221129030147.27400-1-shikemeng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2022-11-29  3:01   ` [PATCH v2 02/10] blk-throttle: Fix that bps of child could exceed bps limited in parent Kemeng Shi
     [not found]     ` <20221129030147.27400-3-shikemeng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2022-11-30 21:09       ` Tejun Heo
2022-11-29  3:01   ` [PATCH v2 03/10] blk-throttle: ignore cgroup without io queued in blk_throtl_cancel_bios Kemeng Shi
2022-11-29  3:01   ` [PATCH v2 05/10] blk-throttle: simpfy low limit reached check in throtl_tg_can_upgrade Kemeng Shi
     [not found]     ` <20221129030147.27400-6-shikemeng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2022-11-30 22:09       ` Tejun Heo
2022-11-29  3:01   ` [PATCH v2 10/10] blk-throttle: avoid dead code in throtl_hierarchy_can_upgrade Kemeng Shi
     [not found]     ` <20221129030147.27400-11-shikemeng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2022-11-30 21:36       ` Tejun Heo
     [not found]         ` <Y4fMyEo0dxPl/Kt1-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-12-01  1:36           ` Kemeng Shi
2022-11-29  3:01 ` [PATCH v2 06/10] blk-throttle: fix typo in comment of throtl_adjusted_limit Kemeng Shi
2022-11-29  3:01 ` [PATCH v2 07/10] blk-throttle: remove incorrect comment for tg_last_low_overflow_time Kemeng Shi
2022-11-29  3:01 ` [PATCH v2 08/10] blk-throttle: remove repeat check of elapsed time from last upgrade in throtl_hierarchy_can_downgrade Kemeng Shi
     [not found]   ` <20221129030147.27400-9-shikemeng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2022-11-30 21:34     ` Tejun Heo
2022-11-29  3:01 ` [PATCH v2 09/10] blk-throttle: Use more siutable time_after check for update of slice_start Kemeng Shi
2022-11-30 21:34   ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y4fKuZPlfhf3+eUt@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shikemeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).