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]
Date:   Mon, 17 Oct 2022 10:00:11 +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 8/8] blk-iocost: Get ioc_now inside weight_updated

The ioc_now parameter of weight_updated is only needed if we need call
propagate_weights. Move ioc_now inside weight_updated to remove
unnecessary get of ioc_now from outside of weight_updated.

Signed-off-by: Kemeng Shi <shikemeng@...wei.com>
---
 block/blk-iocost.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 4815e676733d..e2aaf133deb8 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -1220,18 +1220,21 @@ static u32 current_hweight_max(struct ioc_gq *iocg)
 	return max_t(u32, hwm, 1);
 }
 
-static void weight_updated(struct ioc_gq *iocg, struct ioc_now *now)
+static void weight_updated(struct ioc_gq *iocg)
 {
 	struct ioc *ioc = iocg->ioc;
 	struct blkcg_gq *blkg = iocg_to_blkg(iocg);
 	struct ioc_cgrp *iocc = blkcg_to_iocc(blkg->blkcg);
+	struct ioc_now now;
 	u32 weight;
 
 	lockdep_assert_held(&ioc->lock);
 
 	weight = iocg->cfg_weight ?: iocc->dfl_weight;
-	if (weight != iocg->weight && iocg->active)
-		propagate_weights(iocg, weight, iocg->inuse, true, now);
+	if (weight != iocg->weight && iocg->active) {
+		ioc_now(iocg->ioc, &now);
+		propagate_weights(iocg, weight, iocg->inuse, true, &now);
+	}
 	iocg->weight = weight;
 }
 
@@ -2968,7 +2971,7 @@ static void ioc_pd_init(struct blkg_policy_data *pd)
 	}
 
 	spin_lock_irqsave(&ioc->lock, flags);
-	weight_updated(iocg, NULL);
+	weight_updated(iocg);
 	spin_unlock_irqrestore(&ioc->lock, flags);
 }
 
@@ -3053,7 +3056,6 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
 	struct blkcg *blkcg = css_to_blkcg(of_css(of));
 	struct ioc_cgrp *iocc = blkcg_to_iocc(blkcg);
 	struct blkg_conf_ctx ctx;
-	struct ioc_now now;
 	struct ioc_gq *iocg;
 	u32 v;
 	int ret;
@@ -3074,8 +3076,7 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
 
 			if (iocg) {
 				spin_lock(&iocg->ioc->lock);
-				ioc_now(iocg->ioc, &now);
-				weight_updated(iocg, &now);
+				weight_updated(iocg);
 				spin_unlock(&iocg->ioc->lock);
 			}
 		}
@@ -3101,8 +3102,7 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
 
 	spin_lock(&iocg->ioc->lock);
 	iocg->cfg_weight = v * WEIGHT_ONE;
-	ioc_now(iocg->ioc, &now);
-	weight_updated(iocg, &now);
+	weight_updated(iocg);
 	spin_unlock(&iocg->ioc->lock);
 
 	blkg_conf_finish(&ctx);
-- 
2.30.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ