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: <20250901033220.42982-3-yukuai1@huaweicloud.com>
Date: Mon,  1 Sep 2025 11:32:07 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: hch@...radead.org,
	colyli@...nel.org,
	hare@...e.de,
	dlemoal@...nel.org,
	tieren@...as.com,
	axboe@...nel.dk,
	tj@...nel.org,
	josef@...icpanda.com,
	song@...nel.org,
	kmo@...erainc.com,
	satyat@...gle.com,
	ebiggers@...gle.com,
	neil@...wn.name,
	akpm@...ux-foundation.org
Cc: linux-block@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	cgroups@...r.kernel.org,
	linux-raid@...r.kernel.org,
	yukuai3@...wei.com,
	yukuai1@...weicloud.com,
	yi.zhang@...wei.com,
	yangerkun@...wei.com,
	johnny.chenyi@...wei.com
Subject: [PATCH RFC v3 02/15] block: add QUEUE_FLAG_BIO_ISSUE

From: Yu Kuai <yukuai3@...wei.com>

blkcg_bio_issue_init() is called for every bio, while initialized
bio_issue_time is only used by io-latency. Add a new queue_flag and
only set this flag when io-latency is initialized, so that extra
blk_time_get_ns() from blkcg_bio_issue_init() can be saved for disks
that io-latency is not enabled.

Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
 block/blk-cgroup.h     | 5 ++++-
 block/blk-iolatency.c  | 1 +
 block/blk-mq-debugfs.c | 1 +
 include/linux/blkdev.h | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index d73204d27d72..93e8a9fa76fe 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -372,7 +372,10 @@ static inline void blkg_put(struct blkcg_gq *blkg)
 
 static inline void blkcg_bio_issue_init(struct bio *bio)
 {
-	bio->issue_time_ns = blk_time_get_ns();
+	struct request_queue *q = bdev_get_queue(bio->bi_bdev);
+
+	if (test_bit(QUEUE_FLAG_BIO_ISSUE, &q->queue_flags))
+		bio->issue_time_ns = blk_time_get_ns();
 }
 
 static inline void blkcg_use_delay(struct blkcg_gq *blkg)
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 554b191a6892..c9b3bd12c87c 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -767,6 +767,7 @@ static int blk_iolatency_init(struct gendisk *disk)
 	if (ret)
 		goto err_qos_del;
 
+	blk_queue_flag_set(QUEUE_FLAG_BIO_ISSUE, disk->queue);
 	timer_setup(&blkiolat->timer, blkiolatency_timer_fn, 0);
 	INIT_WORK(&blkiolat->enable_work, blkiolatency_enable_work_fn);
 
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 32c65efdda46..b192647456e1 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -96,6 +96,7 @@ static const char *const blk_queue_flag_name[] = {
 	QUEUE_FLAG_NAME(DISABLE_WBT_DEF),
 	QUEUE_FLAG_NAME(NO_ELV_SWITCH),
 	QUEUE_FLAG_NAME(QOS_ENABLED),
+	QUEUE_FLAG_NAME(BIO_ISSUE),
 };
 #undef QUEUE_FLAG_NAME
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index fe1797bbec42..ca1dcf59cb32 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -657,6 +657,7 @@ enum {
 	QUEUE_FLAG_DISABLE_WBT_DEF,	/* for sched to disable/enable wbt */
 	QUEUE_FLAG_NO_ELV_SWITCH,	/* can't switch elevator any more */
 	QUEUE_FLAG_QOS_ENABLED,		/* qos is enabled */
+	QUEUE_FLAG_BIO_ISSUE,		/* track bio issue time */
 	QUEUE_FLAG_MAX
 };
 
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ