io_uring: spin in iopoll() only when reqs are in a single queue
authorHao Xu <haoxu@linux.alibaba.com>
Sun, 27 Jun 2021 21:37:30 +0000 (05:37 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 30 Jun 2021 20:15:40 +0000 (14:15 -0600)
commit915b3dde9b72cb4f531b04208daafcd0a257b847
tree7c7d74779edb837045b006b3d657d6b0681d5a31
parent99ebe4efbd3882422db1fd6a1b477291ea8bdab7
io_uring: spin in iopoll() only when reqs are in a single queue

We currently spin in iopoll() when requests to be iopolled are for
same file(device), while one device may have multiple hardware queues.
given an example:

hw_queue_0     |    hw_queue_1
req(30us)           req(10us)

If we first spin on iopolling for the hw_queue_0. the avg latency would
be (30us + 30us) / 2 = 30us. While if we do round robin, the avg
latency would be (30us + 10us) / 2 = 20us since we reap the request in
hw_queue_1 in time. So it's better to do spinning only when requests
are in same hardware queue.

Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c