Skip to contentSkip to conversation

blk-mq: Fix poll_stat for new size-based bucketing.

PATCH In review [email protected] 3 participants 6 messages Apr 20, 2017 – Apr 21, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk-mq: Fix poll_stat for new size-based bucketing.

From: Stephen Bates <[email protected]>

Fixes an issue where the size of the poll_stat array in request_queue does not match the size expected by the new size based bucketing for IO completion polling.

Should be applied on top of commit 720b8ccc4500 ("blk-mq: Add a polling specific stats function").

---
 block/blk-mq-debugfs.c | 15 +++++++++------
 block/blk-mq.c         |  8 ++++----
 include/linux/blkdev.h |  5 ++++-
 3 files changed, 17 insertions(+), 11 deletions(-)
block/blk-mq-debugfs.c +9 -6
index df9b688..3057641 100644
@@ -159,14 +159,17 @@ static void print_stat(struct seq_file *m, struct blk_rq_stat *stat)
 static int queue_poll_stat_show(struct seq_file *m, void *v)
 {
 	struct request_queue *q = m->private;
+	int bucket;
 
-	seq_puts(m, "read: ");
-	print_stat(m, &q->poll_stat[READ]);
-	seq_puts(m, "\n");
+	for (bucket = 0; bucket < BLK_MQ_POLL_STATS_BKTS/2; bucket++) {
+		seq_printf(m, "read  (%d Bytes): ", 1 << (9+bucket));
+		print_stat(m, &q->poll_stat[2*bucket]);
+		seq_puts(m, "\n");
 
-	seq_puts(m, "write: ");
-	print_stat(m, &q->poll_stat[WRITE]);
-	seq_puts(m, "\n");
+		seq_printf(m, "write (%d Bytes): ",  1 << (9+bucket));
+		print_stat(m, &q->poll_stat[2*bucket+1]);
+		seq_puts(m, "\n");
+	}
 	return 0;
 }
 
block/blk-mq.c +0 -2
index 9d7645f..81f7c99 100644
@@ -42,8 +42,6 @@ static LIST_HEAD(all_q_list);
 static void blk_mq_poll_stats_start(struct request_queue *q);
 static void blk_mq_poll_stats_fn(struct blk_stat_callback *cb);
 
-/* Must be consisitent with function below */
-#define BLK_MQ_POLL_STATS_BKTS 16
 static int blk_mq_poll_stats_bkt(const struct request *rq)
 {
 	int ddir, bytes, bucket;
include/linux/blkdev.h +4 -1
index 6c4ab0d..6c24786 100644
@@ -46,6 +46,9 @@ struct blk_stat_callback;
 #define BLKDEV_MIN_RQ	4
 #define BLKDEV_MAX_RQ	128	/* Default maximum */
 
+/* Must be consisitent with blk_mq_poll_stats_bkt() */
+#define BLK_MQ_POLL_STATS_BKTS 16
+
 /*
  * Maximum number of blkcg policies allowed to be registered concurrently.
  * Defined here to simplify include dependency.
@@ -517,7 +520,7 @@ struct request_queue {
 	int			poll_nsec;
 
 	struct blk_stat_callback	*poll_cb;
-	struct blk_rq_stat	poll_stat[2];
+	struct blk_rq_stat	poll_stat[BLK_MQ_POLL_STATS_BKTS];
 
 	struct timer_list	timeout;
 	struct work_struct	timeout_work;
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 8 lines · On 04/20/2017 04:59 PM, [email protected] wrote:

From: Stephen Bates <[email protected]>

Fixes an issue where the size of the poll_stat array in request_queue does not match the size expected by the new size based bucketing for IO completion polling.

Should be applied on top of commit 720b8ccc4500 ("blk-mq: Add a polling specific stats function").

Thanks, added. BTW, in the future, we have a format for specifying if a patch fixes another patch. This should have been:

Fixes 720b8ccc4500 ("blk-mq: Add a polling specific stats function")
Signature · 1 line
Jens Axboe
#2 lore raw

DQo+IFRoYW5rcywgYWRkZWQuIEJUVywgaW4gdGhlIGZ1dHVyZSwgd2UgaGF2ZSBhIGZvcm1hdCBm b3Igc3BlY2lmeWluZw0KPiBpZiBhIHBhdGNoIGZpeGVzIGFub3RoZXIgcGF0Y2guIFRoaXMgc2hv dWxkIGhhdmUgYmVlbjoNCg0KVGhhbmtzIQ0KDQo+IEZpeGVzOiA3MjBiOGNjYzQ1MDAgKCJibGst bXE6IEFkZCBhIHBvbGxpbmcgc3BlY2lmaWMgc3RhdHMgZnVuY3Rpb24iKQ0KDQpEdWx5IG5vdGVk IGZvciBuZXh0IHRpbWUuIEFwb2xvZ2llcyBmb3IgdGhlIG1pc3PigKYNCg0KDQoNCg==

maintainer
#3 lore raw
Quoted 9 lines · Stephen Bates
Quoted 3 lines

Thanks, added. BTW, in the future, we have a format for specifying if a patch fixes another patch. This should have been:

Thanks!

Quoted 1 line
Fixes 720b8ccc4500 ("blk-mq: Add a polling specific stats function")

Duly noted for next time. Apologies for the miss…

No worries, I fixed it up for you while committing.

Signature · 1 line
Jens Axboe
maintainer
#4 lore raw
In reply to Stephen Bates
Quoted 8 lines
Quoted 2 lines

Thanks, added. BTW, in the future, we have a format for specifying if a patch fixes another patch. This should have been:

Thanks!

Quoted 1 line
Fixes 720b8ccc4500 ("blk-mq: Add a polling specific stats function")

Duly noted for next time. Apologies for the miss…

Stephen,

I recommend adding a pretty section to your gitconfig:

[pretty]

        fixes = Fixes: %h (\"%s\")

This way you can run:

git log --pretty=fixes <broken_commit_hash>^!

and get the format for free :)

Cheers,
Sagi.

#5 lore raw

PiBJIHJlY29tbWVuZCBhZGRpbmcgYSBwcmV0dHkgc2VjdGlvbiB0byB5b3VyIGdpdGNvbmZpZzoN Cj4NCj5bcHJldHR5XQ0KID4gICAgICAgIGZpeGVzID0gRml4ZXM6ICVoIChcIiVzXCIpDQoNClRo YW5rcyBTYWdpLiBEdWx5IGFkZGVkIQ0KDQoNCg==