On Thu, 2024-06-27 at 17:19 +0800, Wenchao Hao wrote:
Hi Bart,
A small wonder, then should we append __blk_mq_free_request() if req->ref decreased to 0 like following?
if (req_ref_put_and_test(rq)) __blk_mq_free_request(rq);
Thanks,
Bart.
Hi Bart and Wenchao Hao,
It could be have side effect if we surrounding the blk_mq_unique_tag() call with atomic_inc_not_zero(&req->ref) / atomic_dec(&req->ref)? Beacuse __blk_mq_free_request stll have other finish job to.
This is a chicken-and-egg problem. We need to acquire a lock to know which hwq it is, but we need to know which hwq it is to acquire the lock. Therefore, to resolve this dilemma, perhaps we should just take all the hwq locks indiscriminately?
Thanks. Peter