Commit 55a2815d authored by Jens Axboe's avatar Jens Axboe Committed by Li Nan
Browse files

block: only mark bio as tracked if it really is tracked

mainline inclusion
from mainline-v5.16-rc1
commit 90b8faa0
bugzilla: https://gitee.com/openeuler/kernel/issues/IB7FJU

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=90b8faa0e8de1b02b619fb33f6c6e1e13e7d1d70



--------------------------------

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
parent 6bdc51d8
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -210,10 +210,11 @@ 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.
	 */
	if (q->rq_qos) {
		bio_set_flag(bio, BIO_TRACKED);
	if (q->rq_qos)
		__rq_qos_throttle(q->rq_qos, bio);
	}
}

static inline void rq_qos_track(struct request_queue *q, struct request *rq,
				struct bio *bio)