Skip to content

Commit afd7de0

Browse files
committed
block: remove some blk_mq_hw_ctx debugfs entries
Just like the blk_mq_ctx counterparts, we've got a bunch of counters in here that are only for debugfs and are of questionnable value. They are: - dispatched, index of how many requests were dispatched in one go - poll_{considered,invoked,success}, which track poll sucess rates. We're confident in the iopoll implementation at this point, don't bother tracking these. As a bonus, this shrinks each hardware queue from 576 bytes to 512 bytes, dropping a whole cacheline. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 9a14d6c commit afd7de0

File tree

3 files changed

+0
-93
lines changed

3 files changed

+0
-93
lines changed

block/blk-mq-debugfs.c

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -529,70 +529,6 @@ static int hctx_sched_tags_bitmap_show(void *data, struct seq_file *m)
529529
return res;
530530
}
531531

532-
static int hctx_io_poll_show(void *data, struct seq_file *m)
533-
{
534-
struct blk_mq_hw_ctx *hctx = data;
535-
536-
seq_printf(m, "considered=%lu\n", hctx->poll_considered);
537-
seq_printf(m, "invoked=%lu\n", hctx->poll_invoked);
538-
seq_printf(m, "success=%lu\n", hctx->poll_success);
539-
return 0;
540-
}
541-
542-
static ssize_t hctx_io_poll_write(void *data, const char __user *buf,
543-
size_t count, loff_t *ppos)
544-
{
545-
struct blk_mq_hw_ctx *hctx = data;
546-
547-
hctx->poll_considered = hctx->poll_invoked = hctx->poll_success = 0;
548-
return count;
549-
}
550-
551-
static int hctx_dispatched_show(void *data, struct seq_file *m)
552-
{
553-
struct blk_mq_hw_ctx *hctx = data;
554-
int i;
555-
556-
seq_printf(m, "%8u\t%lu\n", 0U, hctx->dispatched[0]);
557-
558-
for (i = 1; i < BLK_MQ_MAX_DISPATCH_ORDER - 1; i++) {
559-
unsigned int d = 1U << (i - 1);
560-
561-
seq_printf(m, "%8u\t%lu\n", d, hctx->dispatched[i]);
562-
}
563-
564-
seq_printf(m, "%8u+\t%lu\n", 1U << (i - 1), hctx->dispatched[i]);
565-
return 0;
566-
}
567-
568-
static ssize_t hctx_dispatched_write(void *data, const char __user *buf,
569-
size_t count, loff_t *ppos)
570-
{
571-
struct blk_mq_hw_ctx *hctx = data;
572-
int i;
573-
574-
for (i = 0; i < BLK_MQ_MAX_DISPATCH_ORDER; i++)
575-
hctx->dispatched[i] = 0;
576-
return count;
577-
}
578-
579-
static int hctx_queued_show(void *data, struct seq_file *m)
580-
{
581-
struct blk_mq_hw_ctx *hctx = data;
582-
583-
seq_printf(m, "%lu\n", hctx->queued);
584-
return 0;
585-
}
586-
587-
static ssize_t hctx_queued_write(void *data, const char __user *buf,
588-
size_t count, loff_t *ppos)
589-
{
590-
struct blk_mq_hw_ctx *hctx = data;
591-
592-
hctx->queued = 0;
593-
return count;
594-
}
595-
596532
static int hctx_run_show(void *data, struct seq_file *m)
597533
{
598534
struct blk_mq_hw_ctx *hctx = data;
@@ -738,9 +674,6 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_hctx_attrs[] = {
738674
{"tags_bitmap", 0400, hctx_tags_bitmap_show},
739675
{"sched_tags", 0400, hctx_sched_tags_show},
740676
{"sched_tags_bitmap", 0400, hctx_sched_tags_bitmap_show},
741-
{"io_poll", 0600, hctx_io_poll_show, hctx_io_poll_write},
742-
{"dispatched", 0600, hctx_dispatched_show, hctx_dispatched_write},
743-
{"queued", 0600, hctx_queued_show, hctx_queued_write},
744677
{"run", 0600, hctx_run_show, hctx_run_write},
745678
{"active", 0400, hctx_active_show},
746679
{"dispatch_busy", 0400, hctx_dispatch_busy_show},

block/blk-mq.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
382382
}
383383
}
384384

385-
data->hctx->queued++;
386385
return rq;
387386
}
388387

@@ -1301,14 +1300,6 @@ struct request *blk_mq_dequeue_from_ctx(struct blk_mq_hw_ctx *hctx,
13011300
return data.rq;
13021301
}
13031302

1304-
static inline unsigned int queued_to_index(unsigned int queued)
1305-
{
1306-
if (!queued)
1307-
return 0;
1308-
1309-
return min(BLK_MQ_MAX_DISPATCH_ORDER - 1, ilog2(queued) + 1);
1310-
}
1311-
13121303
static bool __blk_mq_get_driver_tag(struct request *rq)
13131304
{
13141305
struct sbitmap_queue *bt = &rq->mq_hctx->tags->bitmap_tags;
@@ -1632,8 +1623,6 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
16321623
if (!list_empty(&zone_list))
16331624
list_splice_tail_init(&zone_list, list);
16341625

1635-
hctx->dispatched[queued_to_index(queued)]++;
1636-
16371626
/* If we didn't flush the entire list, we could have told the driver
16381627
* there was more coming, but that turned out to be a lie.
16391628
*/
@@ -4200,14 +4189,9 @@ static int blk_mq_poll_classic(struct request_queue *q, blk_qc_t cookie,
42004189
long state = get_current_state();
42014190
int ret;
42024191

4203-
hctx->poll_considered++;
4204-
42054192
do {
4206-
hctx->poll_invoked++;
4207-
42084193
ret = q->mq_ops->poll(hctx);
42094194
if (ret > 0) {
4210-
hctx->poll_success++;
42114195
__set_current_state(TASK_RUNNING);
42124196
return ret;
42134197
}

include/linux/blk-mq.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,6 @@ struct blk_mq_hw_ctx {
341341
unsigned long queued;
342342
/** @run: Number of dispatched requests. */
343343
unsigned long run;
344-
#define BLK_MQ_MAX_DISPATCH_ORDER 7
345-
/** @dispatched: Number of dispatch requests by queue. */
346-
unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER];
347344

348345
/** @numa_node: NUMA node the storage adapter has been connected to. */
349346
unsigned int numa_node;
@@ -363,13 +360,6 @@ struct blk_mq_hw_ctx {
363360
/** @kobj: Kernel object for sysfs. */
364361
struct kobject kobj;
365362

366-
/** @poll_considered: Count times blk_mq_poll() was called. */
367-
unsigned long poll_considered;
368-
/** @poll_invoked: Count how many requests blk_mq_poll() polled. */
369-
unsigned long poll_invoked;
370-
/** @poll_success: Count how many polled requests were completed. */
371-
unsigned long poll_success;
372-
373363
#ifdef CONFIG_BLK_DEBUG_FS
374364
/**
375365
* @debugfs_dir: debugfs directory for this hardware queue. Named

0 commit comments

Comments
 (0)