Add poll_considered statistic
Subsystems (2)
PATCH 1/2 Add poll_considered statistic
In order to help determine the effectiveness of polling in a running system it is usful to determine the ratio of how often the poll function is called vs how often the completion is checked. For this reason we add a poll_considered variable and add it to the sysfs entry for io_poll.
Signed-off-by Stephen Bates <[email protected]>
--- block/blk-core.c | 8 ++++++-- block/blk-mq-sysfs.c | 4 +++- include/linux/blk-mq.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-)
block/blk-core.c +6 -2
@@ -3307,19 +3307,23 @@ bool blk_poll(struct request_queue *q, blk_qc_t cookie) {struct blk_plug *plug;long state; +unsigned int queue_num; +struct blk_mq_hw_ctx *hctx;if (!q->mq_ops || !q->mq_ops->poll || !blk_qc_t_valid (cookie) || !test_bit (QUEUE_FLAG_POLL , &q->queue_flags))return false; + queue_num =blk_qc_t_to_queue_num (cookie); + hctx = q->queue_hw_ctx[queue_num]; + hctx->poll_considered++; + plug = current->plug;if (plug)blk_flush_plug_list (plug, false); state = current->state;while (!need_resched ()) { -unsigned int queue_num =blk_qc_t_to_queue_num (cookie); -struct blk_mq_hw_ctx *hctx = q->queue_hw_ctx[queue_num];int ret; hctx->poll_invoked++;
block/blk-mq-sysfs.c +3 -1
@@ -176,7 +176,9 @@ static ssize_t blk_mq_sysfs_rq_list_show(struct blk_mq_ctx *ctx, char *page)static ssize_t blk_mq_hw_sysfs_poll_show (struct blk_mq_hw_ctx *hctx,char *page) { -return sprintf (page,"invoked=%lu, success=%lu\n" , hctx->poll_invoked, hctx->poll_success); +return sprintf (page,"considered=%lu, invoked=%lu, success=%lu\n" , + hctx->poll_considered, hctx->poll_invoked, + hctx->poll_success); } static ssize_t blk_mq_hw_sysfs_queued_show(struct blk_mq_hw_ctx *hctx,
include/linux/blk-mq.h +1 -0
@@ -61,6 +61,7 @@ struct blk_mq_hw_ctx {struct blk_mq_cpu_notifier cpu_notifier;struct kobject kobj; +unsigned long poll_considered;unsigned long poll_invoked;unsigned long poll_success; };
Signature · 1 line
2.5.0
Hi All
Apologies. That was the wrong patch. Please ignore.
Cheers
Stephen
Quoted 75 lines · Stephen Bates
In order to help determine the effectiveness of polling in a running system it is usful to determine the ratio of how often the poll function is called vs how often the completion is checked. For this reason we add a
poll_consideredvariable and add it to the sysfs entry forio_poll.Signed-off-by Stephen Bates <[email protected]>---
block/blk-core.c | 8 ++++++-- block/blk-mq-sysfs.c | 4 +++- include/linux/blk-mq.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-)block/blk-core.c +6
-2@@ -3307,19 +3307,23 @@ bool blk_poll(struct request_queue *q, blk_qc_t cookie) {struct blk_plug *plug;long state; +unsigned int queue_num; +struct blk_mq_hw_ctx *hctx;if (!q->mq_ops || !q->mq_ops->poll || !blk_qc_t_valid (cookie) || !test_bit (QUEUE_FLAG_POLL , &q->queue_flags))return false; + queue_num =blk_qc_t_to_queue_num (cookie); + hctx = q->queue_hw_ctx[queue_num]; + hctx->poll_considered++; + plug = current->plug;if (plug)blk_flush_plug_list (plug, false); state = current->state;while (!need_resched ()) { -unsigned int queue_num =blk_qc_t_to_queue_num (cookie); -struct blk_mq_hw_ctx *hctx = q->queue_hw_ctx[queue_num];int ret; hctx->poll_invoked++;block/blk-mq-sysfs.c +3
-1@@ -176,7 +176,9 @@ static ssize_t blk_mq_sysfs_rq_list_show(struct blk_mq_ctx *ctx, char *page)static ssize_t blk_mq_hw_sysfs_poll_show (struct blk_mq_hw_ctx *hctx,char *page) { -return sprintf (page,"invoked=%lu, success=%lu\n" , hctx->poll_invoked, hctx->poll_success); +return sprintf (page,"considered=%lu, invoked=%lu, success=%lu\n" , + hctx->poll_considered, hctx->poll_invoked, + hctx->poll_success); } static ssize_t blk_mq_hw_sysfs_queued_show(struct blk_mq_hw_ctx *hctx,include/linux/blk-mq.h +1
-0@@ -61,6 +61,7 @@ struct blk_mq_hw_ctx {struct blk_mq_cpu_notifier cpu_notifier;struct kobject kobj; +unsigned long poll_considered;unsigned long poll_invoked;unsigned long poll_success; };Signature · 1 line
2.5.0