io_uring/rsrc: merge nodes and io_rsrc_put
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 18 Apr 2023 13:06:36 +0000 (14:06 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 19 Apr 2023 01:38:26 +0000 (19:38 -0600)
commitc376644fb915fbdea8c4a04f859d032a8be352fd
treeb861357c660c9f944a217dcb2be2c80ea8eee3dc
parent63fea89027ff4fd4f350b471ad5b9220d373eec5
io_uring/rsrc: merge nodes and io_rsrc_put

struct io_rsrc_node carries a number of resources represented by struct
io_rsrc_put. That was handy before for sync overhead ammortisation, but
all complexity is gone and nodes are simple and lightweight. Let's
allocate a separate node for each resource.

Nodes and io_rsrc_put and not much different in size, and former are
cached, so node allocation should work better. That also removes some
overhead for nested iteration in io_rsrc_node_ref_zero() /
__io_rsrc_put_work().

Another reason for the patch is that it greatly reduces complexity
by moving io_rsrc_node_switch[_start]() inside io_queue_rsrc_removal(),
so users don't have to care about it.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/c7d3a45b30cc14cd93700a710dd112edc703db98.1681822823.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/filetable.c
io_uring/rsrc.c
io_uring/rsrc.h