diff mbox series

[2/2] blk-throttle: only enable blk-stat when BLK_DEV_THROTTLING_LOW

Message ID 20230412160754.1981705-2-chengming.zhou@linux.dev (mailing list archive)
State New, archived
Headers show
Series [1/2] blk-stat: fix QUEUE_FLAG_STATS clear | expand

Commit Message

Chengming Zhou April 12, 2023, 4:07 p.m. UTC
From: Chengming Zhou <zhouchengming@bytedance.com>

blk_throtl_register() will unconditionally enable blk-stat for gendisk
when register, even when we have no BLK_DEV_THROTTLING_LOW config.

Since the kernel always has only BLK_DEV_THROTTLING config and the
BLK_DEV_THROTTLING_LOW config is still in EXPERIMENTAL state, we can
just skip blk-stat when !BLK_DEV_THROTTLING_LOW.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 block/blk-throttle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tejun Heo April 12, 2023, 5:14 p.m. UTC | #1
On Thu, Apr 13, 2023 at 12:07:54AM +0800, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
> 
> blk_throtl_register() will unconditionally enable blk-stat for gendisk
> when register, even when we have no BLK_DEV_THROTTLING_LOW config.
> 
> Since the kernel always has only BLK_DEV_THROTTLING config and the
> BLK_DEV_THROTTLING_LOW config is still in EXPERIMENTAL state, we can
> just skip blk-stat when !BLK_DEV_THROTTLING_LOW.
> 
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.
diff mbox series

Patch

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 47e9d8be68f3..3c07c9cfa70a 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -2439,11 +2439,12 @@  void blk_throtl_register(struct gendisk *disk)
 #ifndef CONFIG_BLK_DEV_THROTTLING_LOW
 	/* if no low limit, use previous default */
 	td->throtl_slice = DFL_THROTL_SLICE_HD;
-#endif
 
+#else
 	td->track_bio_latency = !queue_is_mq(q);
 	if (!td->track_bio_latency)
 		blk_stat_enable_accounting(q);
+#endif
 }
 
 #ifdef CONFIG_BLK_DEV_THROTTLING_LOW