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,
	"Michal Koutný" <mkoutny@suse.com>,
	"Breno Leitao" <leitao@debian.org>
Subject: [PATCH v2] blk-cgroup: always display debug stats in io.stat
Date: Tue, 03 Mar 2026 06:11:15 -0800	[thread overview]
Message-ID: <20260303-blk_cgroup_debug_stats-v2-1-196c713cb762@debian.org> (raw)

Remove the blkcg_debug_stats toggle and always display detailed
statistics in the cgroup io.stat file. This includes use_delay and
delay_nsec information, cost.wait/cost.indebt/cost.indelay for iocost,
and latency statistics for iolatency.

The stats are already being collected regardless of the toggle, so
gating their display provides no real benefit. Additionally, blk-cgroup
has not been modularized since commit 32e380aedc3de ("blkcg: make
CONFIG_BLK_CGROUP bool"), making the module parameter a historical
artifact. Readers of the nested-keys format should be able to handle
additional fields.

Before (without blkcg_debug_stats enabled):
  253:0 rbytes=6273024 wbytes=0 rios=20 wios=0 dbytes=0 dios=0 cost.usage=0

After:
  253:0 rbytes=6273024 wbytes=0 rios=20 wios=0 dbytes=0 dios=0 cost.usage=0 cost.wait=0 cost.indebt=0 cost.indelay=0

Suggested-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Changes in v2:
- Remove blkcg_debug_stats instead of creating a CONFIG_ to set it. (Michal)
- Link to v1: https://patch.msgid.link/20260204-blk_cgroup_debug_stats-v1-1-09c0754b4242@debian.org
---
 block/blk-cgroup.c    | 6 +-----
 block/blk-cgroup.h    | 1 -
 block/blk-iocost.c    | 9 ++++-----
 block/blk-iolatency.c | 3 ---
 4 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index b70096497d389..8b89a1ce6927a 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -56,8 +56,6 @@ static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS];
 
 static LIST_HEAD(all_blkcgs);		/* protected by blkcg_pol_mutex */
 
-bool blkcg_debug_stats = false;
-
 static DEFINE_RAW_SPINLOCK(blkg_stat_lock);
 
 #define BLKG_DESTROY_BATCH_SIZE  64
@@ -1209,7 +1207,7 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
 			dbytes, dios);
 	}
 
-	if (blkcg_debug_stats && atomic_read(&blkg->use_delay)) {
+	if (atomic_read(&blkg->use_delay)) {
 		seq_printf(s, " use_delay=%d delay_nsec=%llu",
 			atomic_read(&blkg->use_delay),
 			atomic64_read(&blkg->delay_nsec));
@@ -2246,5 +2244,3 @@ bool blk_cgroup_congested(void)
 	return ret;
 }
 
-module_param(blkcg_debug_stats, bool, 0644);
-MODULE_PARM_DESC(blkcg_debug_stats, "True if you want debug stats, false if not");
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 1cce3294634d1..ac38bc3e2486b 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -189,7 +189,6 @@ struct blkcg_policy {
 };
 
 extern struct blkcg blkcg_root;
-extern bool blkcg_debug_stats;
 
 void blkg_init_queue(struct request_queue *q);
 int blkcg_init_disk(struct gendisk *disk);
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index d145db61e5c31..a913e67d0f695 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -3060,11 +3060,10 @@ static void ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
 
 	seq_printf(s, " cost.usage=%llu", iocg->last_stat.usage_us);
 
-	if (blkcg_debug_stats)
-		seq_printf(s, " cost.wait=%llu cost.indebt=%llu cost.indelay=%llu",
-			iocg->last_stat.wait_us,
-			iocg->last_stat.indebt_us,
-			iocg->last_stat.indelay_us);
+	seq_printf(s, " cost.wait=%llu cost.indebt=%llu cost.indelay=%llu",
+		iocg->last_stat.wait_us,
+		iocg->last_stat.indebt_us,
+		iocg->last_stat.indelay_us);
 }
 
 static u64 ioc_weight_prfill(struct seq_file *sf, struct blkg_policy_data *pd,
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 53e8dd2dfa8ad..e99abc97050a0 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -946,9 +946,6 @@ static void iolatency_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
 	unsigned long long avg_lat;
 	unsigned long long cur_win;
 
-	if (!blkcg_debug_stats)
-		return;
-
 	if (iolat->ssd)
 		return iolatency_ssd_stat(iolat, s);
 

---
base-commit: d517cb8cea012f43b069617fc8179b45404f8018
change-id: 20260204-blk_cgroup_debug_stats-e81b887f9c30

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


             reply	other threads:[~2026-03-03 14:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 14:11 Breno Leitao [this message]
2026-03-03 17:46 ` Tejun Heo
2026-03-04  9:56   ` Breno Leitao
2026-03-04 16:48     ` Tejun Heo
2026-03-04 17:11       ` Breno Leitao
2026-03-04 13:28   ` Michal Koutný
2026-03-04 13:48     ` Breno Leitao
2026-03-04 16:42     ` Tejun Heo

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=20260303-blk_cgroup_debug_stats-v2-1-196c713cb762@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=mkoutny@suse.com \
    --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®