From: weiping zhang <zhangweiping@didichuxing.com>
To: <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>
Subject: [PATCH] blk-mq-debugfs: add mapping show for hw queue to cpu
Date: Thu, 13 Jul 2017 00:54:00 +0800 [thread overview]
Message-ID: <20170712165400.GA9696@localhost.didichuxing.com> (raw)
A mapping show as following:
hctx cpus
hctx0 0 1
hctx1 2
hctx2 3
hctx3 4 5
Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
block/blk-mq-debugfs.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 9ebc294..a311d5a 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -175,6 +175,23 @@ static int queue_poll_stat_show(void *data, struct seq_file *m)
return 0;
}
+static int queue_mapping_show(void *data, struct seq_file *m)
+{
+ struct request_queue *q = data;
+ struct blk_mq_hw_ctx *hctx;
+ struct blk_mq_ctx *ctx;
+ int i, j;
+
+ seq_puts(m, "hctx\t\tcpus\n");
+ queue_for_each_hw_ctx(q, hctx, i) {
+ seq_printf(m, "hctx%u\t\t", hctx->queue_num);
+ hctx_for_each_ctx(hctx, ctx, j)
+ seq_printf(m, "%3u ", ctx->cpu);
+ seq_puts(m, "\n");
+ }
+ return 0;
+}
+
#define HCTX_STATE_NAME(name) [BLK_MQ_S_##name] = #name
static const char *const hctx_state_name[] = {
HCTX_STATE_NAME(STOPPED),
@@ -754,6 +771,7 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = {
{"requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops},
{"state", 0600, queue_state_show, queue_state_write},
{"write_hints", 0600, queue_write_hint_show, queue_write_hint_store},
+ {"mapping", 0400, queue_mapping_show},
{},
};
--
2.9.4
next reply other threads:[~2017-07-12 16:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 16:54 weiping zhang [this message]
2017-07-12 16:57 ` [PATCH] blk-mq-debugfs: add mapping show for hw queue to cpu Jens Axboe
2017-07-12 17:13 ` weiping zhang
2017-07-12 17:25 ` Jens Axboe
2017-07-13 14:09 ` weiping zhang
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=20170712165400.GA9696@localhost.didichuxing.com \
--to=zhangweiping@didichuxing.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.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