io_uring/rsrc: add last-lookup cache hit to io_rsrc_node_lookup() io_uring-rsrc.3
authorJens Axboe <axboe@kernel.dk>
Sun, 27 Oct 2024 15:19:51 +0000 (09:19 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 29 Oct 2024 15:08:50 +0000 (09:08 -0600)
commit6a660351179109255ae971bb9883d20335a71d24
treeadaddb760878ce6161f902a8592cd2894f77bc97
parent8d69ca3c0fe79ab5987c91e823feccce3d3a3c0f
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). If a cached node is removed from
the given table, it'll get cleared in the cache as well.
io_reset_rsrc_node() takes care of that, which is used in the spots
that's replacing a node.

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/rsrc.c
io_uring/rsrc.h