Jens Axboe cc3cec8367 io_uring: speedup provided buffer handling
In testing high frequency workloads with provided buffers, we spend a
lot of time in allocating and freeing the buffer units themselves.
Rather than repeatedly free and alloc them, add a recycling cache
instead. There are two caches:

- ctx->io_buffers_cache. This is the one we grab from in the submission
  path, and it's protected by ctx->uring_lock. For inline completions,
  we can recycle straight back to this cache and not need any extra
  locking.

- ctx->io_buffers_comp. If we're not under uring_lock, then we use this
  list to recycle buffers. It's protected by the completion_lock.

On adding a new buffer, check io_buffers_cache. If it's empty, check if
we can splice entries from the io_buffers_comp_cache.

This reduces about 5-10% of overhead from provided buffers, bringing it
pretty close to the non-provided path.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-03-10 06:33:14 -07:00
..
2022-01-30 22:13:37 +09:00
2022-01-22 08:33:37 +02:00
2021-08-19 09:02:55 +09:00
2022-03-06 12:19:36 -08:00
2021-11-09 10:02:51 -08:00
2021-10-25 19:11:50 -07:00
2022-01-12 11:11:34 -08:00
2021-12-03 18:44:06 +01:00
2022-02-11 11:36:32 -08:00
2021-11-03 09:23:25 -07:00
2022-02-04 00:12:22 -06:00
2022-02-02 10:14:31 -08:00
2022-02-09 09:56:57 -08:00
2022-01-22 08:33:38 +02:00
2022-02-01 11:23:02 -08:00
2022-01-10 11:48:37 -08:00
2021-08-19 09:02:55 +09:00
2022-02-26 09:53:19 -08:00
2021-12-17 16:56:35 +09:00
2022-01-22 08:33:34 +02:00
2021-11-17 09:26:09 +01:00
2022-03-01 11:31:37 -08:00
2022-01-12 13:45:12 -08:00
2022-01-22 08:33:35 +02:00
2022-02-04 00:12:22 -06:00
2022-01-22 08:33:38 +02:00
\n
2022-01-28 17:51:31 +02:00
2022-01-22 08:33:36 +02:00
2021-08-10 17:57:22 +02:00