Skip to contentSkip to conversation

blk-iolatency: only account submitted bios

PATCH In review Dennis Zhou 2 participants 3 messages May 23, 2019 – Jun 20, 2019

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

PATCH 1/1 blk-iolatency: only account submitted bios

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.

---
 block/blk-iolatency.c | 4 ++++
 1 file changed, 4 insertions(+)
block/blk-iolatency.c +4 -0
index 507212d75ee2..58bac44ba78a 100644
@@ -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;
Signature · 1 line
2.17.1
#1 lore raw

Hi Jens,

Quoted 30 lines · 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.

---
 block/blk-iolatency.c | 4 ++++
 1 file changed, 4 insertions(+)
block/blk-iolatency.c +4 -0
index 507212d75ee2..58bac44ba78a 100644
@@ -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;
Signature · 1 line
2.17.1

Can you please take a look at this?

Thanks,
Dennis

maintainer
#2 lore raw
In reply to Dennis Zhou
Quoted 5 lines · 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.

Looks good to me, applied.

Signature · 1 line
Jens Axboe