Skip to content

Commit

Permalink
block: only mark bio as tracked if it really is tracked
Browse files Browse the repository at this point in the history
We set BIO_TRACKED unconditionally when rq_qos_throttle() is called, even
though we may not even have an rq_qos handler. Only mark it as TRACKED if
it really is potentially tracked.

This saves considerable time for the case where the bio isn't tracked:

     2.64%     -1.65%  [kernel.vmlinux]  [k] bio_endio

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Oct 18, 2021
1 parent b608762 commit 90b8faa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions block/blk-rq-qos.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ static inline void rq_qos_throttle(struct request_queue *q, struct bio *bio)
* BIO_TRACKED lets controllers know that a bio went through the
* normal rq_qos path.
*/
bio_set_flag(bio, BIO_TRACKED);
if (q->rq_qos)
if (q->rq_qos) {
bio_set_flag(bio, BIO_TRACKED);
__rq_qos_throttle(q->rq_qos, bio);
}
}

static inline void rq_qos_track(struct request_queue *q, struct request *rq,
Expand Down

0 comments on commit 90b8faa

Please sign in to comment.