summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-04-15 22:08:33 +0100
committerJens Axboe <axboe@kernel.dk>2022-04-24 18:02:52 -0600
commita6d97a8a77cb66cbbf6a5afc6708b1c2f5b00ca2 (patch)
treeec35a68c6ea380de34b7dac0cb3b84079f5bbfb6 /fs/io_uring.c
parent17b147f6c1f21caef554004e19207810cbc08a8e (diff)
downloadlwn-a6d97a8a77cb66cbbf6a5afc6708b1c2f5b00ca2.tar.gz
lwn-a6d97a8a77cb66cbbf6a5afc6708b1c2f5b00ca2.zip
io_uring: add data_race annotations
We have several racy reads, mark them with data_race() to demonstrate this fact. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/7e56e750d294c70b2a56938bd733386f19f0eb53.1650056133.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 5bb46fe161c1..f29ab9055852 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2268,7 +2268,7 @@ static __cold bool __io_alloc_req_refill(struct io_ring_ctx *ctx)
* locked cache, grab the lock and move them over to our submission
* side cache.
*/
- if (READ_ONCE(ctx->locked_free_nr) > IO_COMPL_BATCH) {
+ if (data_race(ctx->locked_free_nr) > IO_COMPL_BATCH) {
io_flush_cached_locked_reqs(ctx, &ctx->submit_state);
if (!io_req_cache_empty(ctx))
return true;
@@ -2562,8 +2562,8 @@ static void tctx_task_work(struct callback_head *cb)
handle_tw_list(node2, &ctx, &uring_locked);
cond_resched();
- if (!tctx->task_list.first &&
- !tctx->prior_task_list.first && uring_locked)
+ if (data_race(!tctx->task_list.first) &&
+ data_race(!tctx->prior_task_list.first) && uring_locked)
io_submit_flush_completions(ctx);
}