io_uring: limit parallelism of buffered writes
authorJens Axboe <axboe@kernel.dk>
Tue, 10 Sep 2019 15:15:04 +0000 (09:15 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 10 Sep 2019 15:49:35 +0000 (09:49 -0600)
commit54a91f3bb9b96ed86bc12b2f7e06b3fce8e86503
treec4d5a47fb9d06ec67ab341dc9490590f8c138a6a
parent18d9be1a970c3704366df902b00871bea88d9f14
io_uring: limit parallelism of buffered writes

All the popular filesystems need to grab the inode lock for buffered
writes. With io_uring punting buffered writes to async context, we
observe a lot of contention with all workers hamming this mutex.

For buffered writes, we generally don't need a lot of parallelism on
the submission side, as the flushing will take care of that for us.
Hence we don't need a deep queue on the write side, as long as we
can safely punt from the original submission context.

Add a workqueue with a limit of 2 that we can use for buffered writes.
This greatly improves the performance and efficiency of higher queue
depth buffered async writes with io_uring.

Reported-by: Andres Freund <andres@anarazel.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c