mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Jens Axboe <axboe@kernel.dk>, Tejun Heo <tj@kernel.org>,
	 Josef Bacik <josef@toxicpanda.com>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	 cgroups@vger.kernel.org, thevlad@meta.com, kernel-team@meta.com,
	 Breno Leitao <leitao@debian.org>
Subject: [PATCH] blk-cgroup: add CONFIG_BLK_CGROUP_DEBUG_STATS option
Date: Wed, 04 Feb 2026 08:15:12 -0800	[thread overview]
Message-ID: <20260204-blk_cgroup_debug_stats-v1-1-09c0754b4242@debian.org> (raw)

Add a Kconfig option to enable blkcg_debug_stats by default at compile
time. When CONFIG_BLK_CGROUP_DEBUG_STATS is enabled, additional debugging
information is shown in the cgroup io.stat file, including cost.wait,
cost.indebt, and cost.indelay for iocost, as well as latency statistics
for iolatency.

The runtime module parameter blkcg_debug_stats remains functional,
allowing the setting to be toggled regardless of the compile-time
default.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
This option is commonly enabled by some hyperscalers, either through the
command line or custom patches. Let's make it part of the kernel.
---
 block/Kconfig      | 15 +++++++++++++++
 block/blk-cgroup.c |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/block/Kconfig b/block/Kconfig
index 15027963472d7..03fb95a24564c 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -170,6 +170,21 @@ config BLK_CGROUP_IOPRIO
 	scheduler and block devices process requests. Only some I/O schedulers
 	and some block devices support I/O priorities.
 
+config BLK_CGROUP_DEBUG_STATS
+	bool "Enable blkcg debug stats by default"
+	depends on BLK_CGROUP
+	default n
+	help
+	Enable blkcg debug stats by default. This provides additional
+	debugging information in the cgroup io.stat file, including
+	cost.wait, cost.indebt, cost.indelay for iocost and latency
+	statistics for iolatency.
+
+	This can also be enabled at runtime via the blkcg_debug_stats
+	module parameter.
+
+	If unsure, say N.
+
 config BLK_DEBUG_FS
 	bool "Block layer debugging information in debugfs"
 	default y
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 3cffb68ba5d87..67687d02b3cbc 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -56,7 +56,7 @@ static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS];
 
 static LIST_HEAD(all_blkcgs);		/* protected by blkcg_pol_mutex */
 
-bool blkcg_debug_stats = false;
+bool blkcg_debug_stats = IS_ENABLED(CONFIG_BLK_CGROUP_DEBUG_STATS);
 
 static DEFINE_RAW_SPINLOCK(blkg_stat_lock);
 

---
base-commit: 4c87cdd0328495759f6e9f9f4e1e53ef8032a76f
change-id: 20260204-blk_cgroup_debug_stats-e81b887f9c30

Best regards,
--  
Breno Leitao <leitao@debian.org>


             reply	other threads:[~2026-02-04 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 16:15 Breno Leitao [this message]
2026-02-12 10:26 ` Michal Koutný
2026-03-03 13:59   ` Breno Leitao

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=20260204-blk_cgroup_debug_stats-v1-1-09c0754b4242@debian.org \
    --to=leitao@debian.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thevlad@meta.com \
    --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®