Hi, 在 2023/10/27 0:29, Bart Van Assche 写道:
If blk_mq_get_tag() can't allocate a tag, and if multiple threads are waiting for a tag, the thread that called blk_mq_get_tag() first is granted the first tag that is released. I think this guarantees fairness if all requests have a similar latency. There will be some unfairness if there are significant differences in latency per logical unit, e.g. because all requests sent to one logical unit are small and because all requests sent to another logical unit are large. Whether or not this matters depends on the use case.
I'm afraid that is not correct, fairness can't be guranteed at all, not even with just one scsi disk. This is because there are 8 wait queues in sbitmap, and threads are waiting in roundrobin mode, and each time wake_batch tags are released, wake_batch threads of one wait queue will be woke up, regardless that some threads can't grab tag after woken up, what's worse, thoese thread will be added to the tail of waitqueue again. In the case that high io pressure under a slow disk, this behaviour will cause that io tail latency will be quite bad compared to sq from old kernel. AFAIC, disable tag sharing will definitely case some regresion, for example, one disk will high io pressure, and another disk only issure one IO at a time, disable tag sharing can improve brandwith of fist disk, however, for the latter disk, IO latency will definitely be much worse. Thanks, Kuai
Thanks, Bart. .