io_uring/net: always setup an io_async_msghdr
authorJens Axboe <axboe@kernel.dk>
Sat, 16 Mar 2024 23:26:09 +0000 (17:26 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 15 Apr 2024 14:10:25 +0000 (08:10 -0600)
commit790b68b32a678b65b161861f83b2b782b6b9246b
treefac63a44d2d50d770f65e5a68dfc11cb0551a6b7
parentf5b00ab2221a26202da7d10542a98203075bfdf8
io_uring/net: always setup an io_async_msghdr

Rather than use an on-stack one and then need to allocate and copy if
async execution is required, always grab one upfront. This should be
very cheap, and potentially even have cache hotness benefits for
back-to-back send/recv requests.

For any recv type of request, this is probably a good choice in general,
as it's expected that no data is available initially. For send this is
not necessarily the case, as space in the socket buffer is expected to
be available. However, getting a cached io_async_msghdr is very cheap,
and as it should be cache hot, probably the difference here is neglible,
if any.

A nice side benefit is that io_setup_async_msg can get killed
completely, which has some nasty iovec manipulation code.

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