io-wq: optimise locking in io_worker_handle_work()
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 4 Mar 2020 13:14:10 +0000 (16:14 +0300)
committerJens Axboe <axboe@kernel.dk>
Wed, 4 Mar 2020 18:39:04 +0000 (11:39 -0700)
commit58e3931987377d3f4ec7bbc13e4ea0aab52dc6b0
tree624d986e6422514759b574c5ae3b62a8dc25f8f1
parentdc026a73c7221b4d9d146ed0bde69ff578ebe8dc
io-wq: optimise locking in io_worker_handle_work()

There are 2 optimisations:
- Now, io_worker_handler_work() do io_assign_current_work() twice per
request, and each one adds lock/unlock(worker->lock) pair. The first is
to reset worker->cur_work to NULL, and the second to set a real work
shortly after. If there is a dependant work, set it immediately, that
effectively removes the extra NULL'ing.

- And there is no use in taking wqe->lock for linked works, as they are
not hashed now. Optimise it out.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io-wq.c