io_uring: don't hold fixed_file_data's lock when registering files
PATCH 1/1 io_uring: don't hold fixed_file_data's lock when registering files
While registering new files by IORING_REGISTER_FILES, there're not valid fixed_file_ref_node at the moment, so it's unnecessary to hold fixed_file_data's lock when registering files.
--- fs/io_uring.c | 2 -- 1 file changed, 2 deletions(-)
fs/io_uring.c +0 -2
@@ -7257,9 +7257,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, } ctx->file_data->cur_refs = &ref_node->refs; -spin_lock (&ctx->file_data->lock);list_add (&ref_node->node, &ctx->file_data->ref_list); -spin_unlock (&ctx->file_data->lock);percpu_ref_get (&ctx->file_data->refs);return ret; }
Signature · 1 line
2.17.2
Jens Axboe
maintainerQuoted 3 lines · Xiaoguang Wang
While registering new files by
IORING_REGISTER_FILES, there're not validfixed_file_ref_nodeat the moment, so it's unnecessary to hold fixed_file_data's lock when registering files.
Even if that were the case (I haven't looked too closely at it yet), it would a) need a big comment explaining why, and b) some justification on why this would be a change we'd want to make.
On b, are you seeing any tangible differences with this?
Signature · 1 line
Jens Axboe
hi,
Quoted 10 lines · Xiaoguang Wang
Quoted 3 lines
While registering new files by
IORING_REGISTER_FILES, there're not validfixed_file_ref_nodeat the moment, so it's unnecessary to hold fixed_file_data's lock when registering files.Even if that were the case (I haven't looked too closely at it yet), it would a) need a big comment explaining why, and b) some justification on why this would be a change we'd want to make.
On b, are you seeing any tangible differences with this?
No, just found this by reading source codes.
Regards,
Xiaoguang Wang
Quoted 1 line
Jens Axboe
maintainerQuoted 7 lines · Xiaoguang Wang
hi,
Quoted 5 lines · Xiaoguang Wang
Quoted 3 lines
While registering new files by
IORING_REGISTER_FILES, there're not validfixed_file_ref_nodeat the moment, so it's unnecessary to hold fixed_file_data's lock when registering files.
Quoted 6 lines
Quoted 5 lines
Even if that were the case (I haven't looked too closely at it yet), it would a) need a big comment explaining why, and b) some justification on why this would be a change we'd want to make.
On b, are you seeing any tangible differences with this?
No, just found this by reading source codes.
OK, then I suggest we leave it as it is. The data race analyzers wouldn't be very happy with it either.
Signature · 1 line
Jens Axboe