lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221017020011.25016-8-shikemeng@huawei.com>
Date:   Mon, 17 Oct 2022 10:00:10 +0800
From:   Kemeng Shi <shikemeng@...wei.com>
To:     <tj@...nel.org>, <axboe@...nel.dk>, <linux-block@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
CC:     <shikemeng@...wei.com>
Subject: [PATCH 7/8] blk-iocost: Remove redundant initialization of struct ioc_gq

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@...wei.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ