linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-iolatency: only account submitted bios
@ 2019-05-23 20:10 Dennis Zhou
  2019-06-15 16:51 ` Dennis Zhou
  2019-06-20  9:29 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Dennis Zhou @ 2019-05-23 20:10 UTC (permalink / raw)
  To: Jens Axboe, Josef Bacik
  Cc: kernel-team, linux-block, linux-kernel, Dennis Zhou

As is, iolatency recognizes done_bio and cleanup as ending paths. If a
request is marked REQ_NOWAIT and fails to get a request, the bio is
cleaned up via rq_qos_cleanup() and ended in bio_wouldblock_error().
This results in underflowing the inflight counter. Fix this by only
accounting bios that were actually submitted.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>
---
 block/blk-iolatency.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 507212d75ee2..58bac44ba78a 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -599,6 +599,10 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
 	if (!blkg || !bio_flagged(bio, BIO_TRACKED))
 		return;
 
+	/* We didn't actually submit this bio, don't account it. */
+	if (bio->bi_status == BLK_STS_AGAIN)
+		return;
+
 	iolat = blkg_to_lat(bio->bi_blkg);
 	if (!iolat)
 		return;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-iolatency: only account submitted bios
  2019-05-23 20:10 [PATCH] blk-iolatency: only account submitted bios Dennis Zhou
@ 2019-06-15 16:51 ` Dennis Zhou
  2019-06-20  9:29 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Dennis Zhou @ 2019-06-15 16:51 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Dennis Zhou, Josef Bacik, kernel-team, linux-block, linux-kernel

Hi Jens,

On Thu, May 23, 2019 at 04:10:18PM -0400, Dennis Zhou wrote:
> As is, iolatency recognizes done_bio and cleanup as ending paths. If a
> request is marked REQ_NOWAIT and fails to get a request, the bio is
> cleaned up via rq_qos_cleanup() and ended in bio_wouldblock_error().
> This results in underflowing the inflight counter. Fix this by only
> accounting bios that were actually submitted.
> 
> Signed-off-by: Dennis Zhou <dennis@kernel.org>
> Cc: Josef Bacik <josef@toxicpanda.com>
> ---
>  block/blk-iolatency.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
> index 507212d75ee2..58bac44ba78a 100644
> --- a/block/blk-iolatency.c
> +++ b/block/blk-iolatency.c
> @@ -599,6 +599,10 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
>  	if (!blkg || !bio_flagged(bio, BIO_TRACKED))
>  		return;
>  
> +	/* We didn't actually submit this bio, don't account it. */
> +	if (bio->bi_status == BLK_STS_AGAIN)
> +		return;
> +
>  	iolat = blkg_to_lat(bio->bi_blkg);
>  	if (!iolat)
>  		return;
> -- 
> 2.17.1
> 

Can you please take a look at this?

Thanks,
Dennis

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-iolatency: only account submitted bios
  2019-05-23 20:10 [PATCH] blk-iolatency: only account submitted bios Dennis Zhou
  2019-06-15 16:51 ` Dennis Zhou
@ 2019-06-20  9:29 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2019-06-20  9:29 UTC (permalink / raw)
  To: Dennis Zhou, Josef Bacik; +Cc: kernel-team, linux-block, linux-kernel

On 5/23/19 2:10 PM, Dennis Zhou wrote:
> As is, iolatency recognizes done_bio and cleanup as ending paths. If a
> request is marked REQ_NOWAIT and fails to get a request, the bio is
> cleaned up via rq_qos_cleanup() and ended in bio_wouldblock_error().
> This results in underflowing the inflight counter. Fix this by only
> accounting bios that were actually submitted.

Looks good to me, applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-20  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 20:10 [PATCH] blk-iolatency: only account submitted bios Dennis Zhou
2019-06-15 16:51 ` Dennis Zhou
2019-06-20  9:29 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).