From: Tejun Heo <tj@kernel.org>
To: Kemeng Shi <shikemeng@huawei.com>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] blk-iocost: Avoid to call current_hweight_max if iocg->inuse == iocg->active
Date: Mon, 17 Oct 2022 09:15:39 -1000 [thread overview]
Message-ID: <Y02p23KdUZfkYyzI@slm.duckdns.org> (raw)
In-Reply-To: <20221017020011.25016-7-shikemeng@huawei.com>
On Mon, Oct 17, 2022 at 10:00:09AM +0800, Kemeng Shi wrote:
> The old_hwi is already max hweight_inuse if iocg->inuse == iocg->active.
> Remove unnecessary calculation.
>
> Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
> ---
> block/blk-iocost.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/block/blk-iocost.c b/block/blk-iocost.c
> index 96c1571a8a1d..fa90f471dfdc 100644
> --- a/block/blk-iocost.c
> +++ b/block/blk-iocost.c
> @@ -2299,7 +2299,10 @@ static void ioc_timer_fn(struct timer_list *timer)
> * Determine the donation amount.
> */
> current_hweight(iocg, &hwa, &old_hwi);
> - hwm = current_hweight_max(iocg);
> + if (iocg->inuse == iocg->active)
> + hwm = old_hwi;
> + else
> + hwm = current_hweight_max(iocg);
I don't think this is correct. The intermediate nodes might be donating.
This also isn't a meaningful optimization given that it's in the cold
periodic timer path. I'd much rather keep the code simpler unless the
performance benfeit can be clearly demonstrated.
Thanks.
--
tejun
next prev parent reply other threads:[~2022-10-17 19:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 2:00 [PATCH 0/8] A few cleanup and bugfix patches for blk-iocost Kemeng Shi
2022-10-17 2:00 ` [PATCH 1/8] blk-iocost: Fix typo in comment Kemeng Shi
2022-10-17 18:52 ` Tejun Heo
2022-10-17 2:00 ` [PATCH 2/8] blk-iocost: Reset vtime_base_rate in ioc_refresh_params Kemeng Shi
2022-10-17 18:59 ` Tejun Heo
2022-10-17 2:00 ` [PATCH 3/8] blk-iocost: Trace vtime_base_rate instead of vtime_rate Kemeng Shi
2022-10-17 19:03 ` Tejun Heo
2022-10-17 2:00 ` [PATCH 4/8] blk-iocost: Remove vrate member in struct ioc_now Kemeng Shi
2022-10-17 19:08 ` Tejun Heo
2022-10-17 2:00 ` [PATCH 5/8] blk-iocost: Correct comment in blk_iocost_init Kemeng Shi
2022-10-17 19:10 ` Tejun Heo
2022-10-17 2:00 ` [PATCH 6/8] blk-iocost: Avoid to call current_hweight_max if iocg->inuse == iocg->active Kemeng Shi
2022-10-17 19:15 ` Tejun Heo [this message]
2022-10-17 2:00 ` [PATCH 7/8] blk-iocost: Remove redundant initialization of struct ioc_gq Kemeng Shi
2022-10-17 19:16 ` Tejun Heo
2022-10-17 2:00 ` [PATCH 8/8] blk-iocost: Get ioc_now inside weight_updated Kemeng Shi
2022-10-17 19:19 ` 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=Y02p23KdUZfkYyzI@slm.duckdns.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.