io_uring/rsrc: add last-lookup cache hit to io_rsrc_node_lookup()
authorJens Axboe <axboe@kernel.dk>
Sun, 27 Oct 2024 15:19:51 +0000 (09:19 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 28 Oct 2024 19:23:03 +0000 (13:23 -0600)
commite0f9fad516c367c4c780f246768dd3627dcb8742
treeecc5f98f32b7ca0d3a19a9b7b8fecbb83b130fd1
parentdf4e0bd0d720c956a7c53d37dbdfc6d4c18ca749
io_uring/rsrc: add last-lookup cache hit to io_rsrc_node_lookup()

This avoids array_index_nospec() for repeated lookups on the same node,
which can be quite common (and costly). When the node sees its last
put, it'll clear the cache as well.

Note: need to double check this is 100% safe wrt speculation, but I
believe it should be as we're not using the passed in value to index
any arrays (directly).

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/io_uring_types.h
io_uring/filetable.c
io_uring/rsrc.c
io_uring/rsrc.h