aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorStephen Bates <sbates@raithlin.com>2016-09-13 12:23:15 -0600
committerJens Axboe <axboe@fb.com>2016-09-14 08:41:21 -0600
commit6e219353afa1f67f453141f7462b01708ebf5574 (patch)
treed09924891e887e970be9a18442bebc40d2ad64ee /block/blk-core.c
parentnbd: allow block mq to deal with timeouts (diff)
downloadwireguard-linux-6e219353afa1f67f453141f7462b01708ebf5574.tar.xz
wireguard-linux-6e219353afa1f67f453141f7462b01708ebf5574.zip
block: 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 <sbates@raithlin.com> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 34ff8088eebe..14d7c0740dc0 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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++;