]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: pre-initialise some of req fields
authorPavel Begunkov <asml.silence@gmail.com>
Sat, 26 Jun 2021 20:40:49 +0000 (21:40 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 30 Jun 2021 20:15:40 +0000 (14:15 -0600)
commit74d9c6d6f3d4e7425c0793b01991b6262ec91cc4
treeaadeb6e8c2b16ed616bc351e24b1a28040221640
parentadb50bbd3625f2c9151140a78f64d693d0594c56
io_uring: pre-initialise some of req fields

Most of requests are allocated from an internal cache, so it's waste of
time fully initialising them every time. Instead, let's pre-init some of
the fields we can during initial allocation (e.g. kmalloc(), see
io_alloc_req()) and keep them valid on request recycling. There are four
of them in this patch:

->ctx is always stays the same
->link is NULL on free, it's an invariant
->result is not even needed to init, just a precaution
->async_data we now clean in io_dismantle_req() as it's likely to
   never be allocated.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/892ba0e71309bba9fe9e0142472330bbf9d8f05d.1624739600.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c