]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: improve task work cache utilization
authorJens Axboe <axboe@kernel.dk>
Thu, 24 Mar 2022 16:17:44 +0000 (10:17 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 24 Mar 2022 23:09:26 +0000 (17:09 -0600)
commit379f99b627a055fdb8ad02a6d1ab1a27be86438a
treef1386961219cc5fdae8697f05aac801b7ae95e47
parentd0e5416a964f2de21bd67dec6792619701774d78
io_uring: improve task work cache utilization

While profiling task_work intensive workloads, I noticed that most of
the time in tctx_task_work() is spending stalled on loading 'req'. This
is one of the unfortunate side effects of using linked lists,
particularly when they end up being passe around.

Prefetch the next request, if there is one. There's a sufficient amount
of work in between that this makes it available for the next loop.

While fiddling with the cache layout, move the link outside of the
hot completion cacheline. It's rarely used in hot workloads, so better
to bring in kbuf which is used for networked loads with provided buffers.

This reduces tctx_task_work() overhead from ~3% to 1-1.5% in my testing.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c