mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kemeng Shi <shikemeng@huawei.com>
To: <tj@kernel.org>, <axboe@kernel.dk>, <linux-block@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <shikemeng@huawei.com>
Subject: [PATCH 7/8] blk-iocost: Remove redundant initialization of struct ioc_gq
Date: Mon, 17 Oct 2022 10:00:10 +0800	[thread overview]
Message-ID: <20221017020011.25016-8-shikemeng@huawei.com> (raw)
In-Reply-To: <20221017020011.25016-1-shikemeng@huawei.com>

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.

Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
---
 block/blk-iocost.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index fa90f471dfdc..4815e676733d 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -2946,16 +2946,10 @@ static void ioc_pd_init(struct blkg_policy_data *pd)
 	struct ioc_gq *iocg = pd_to_iocg(pd);
 	struct blkcg_gq *blkg = pd_to_blkg(&iocg->pd);
 	struct ioc *ioc = q_to_ioc(blkg->q);
-	struct ioc_now now;
 	struct blkcg_gq *tblkg;
 	unsigned long flags;
 
-	ioc_now(ioc, &now);
-
 	iocg->ioc = ioc;
-	atomic64_set(&iocg->vtime, now.vnow);
-	atomic64_set(&iocg->done_vtime, now.vnow);
-	atomic64_set(&iocg->active_period, atomic64_read(&ioc->cur_period));
 	INIT_LIST_HEAD(&iocg->active_list);
 	INIT_LIST_HEAD(&iocg->walk_list);
 	INIT_LIST_HEAD(&iocg->surplus_list);
@@ -2974,7 +2968,7 @@ static void ioc_pd_init(struct blkg_policy_data *pd)
 	}
 
 	spin_lock_irqsave(&ioc->lock, flags);
-	weight_updated(iocg, &now);
+	weight_updated(iocg, NULL);
 	spin_unlock_irqrestore(&ioc->lock, flags);
 }
 
-- 
2.30.0


  parent reply	other threads:[~2022-10-17  2:00 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
2022-10-17  2:00 ` Kemeng Shi [this message]
2022-10-17 19:16   ` [PATCH 7/8] blk-iocost: Remove redundant initialization of struct ioc_gq 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=20221017020011.25016-8-shikemeng@huawei.com \
    --to=shikemeng@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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

all inboxes | Powered by JetHome®