Commit a6d97a8a authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: add data_race annotations

We have several racy reads, mark them with data_race() to demonstrate
this fact.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/7e56e750d294c70b2a56938bd733386f19f0eb53.1650056133.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 17b147f6
...@@ -2268,7 +2268,7 @@ static __cold bool __io_alloc_req_refill(struct io_ring_ctx *ctx) ...@@ -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 * locked cache, grab the lock and move them over to our submission
* side cache. * 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); io_flush_cached_locked_reqs(ctx, &ctx->submit_state);
if (!io_req_cache_empty(ctx)) if (!io_req_cache_empty(ctx))
return true; return true;
...@@ -2562,8 +2562,8 @@ static void tctx_task_work(struct callback_head *cb) ...@@ -2562,8 +2562,8 @@ static void tctx_task_work(struct callback_head *cb)
handle_tw_list(node2, &ctx, &uring_locked); handle_tw_list(node2, &ctx, &uring_locked);
cond_resched(); cond_resched();
if (!tctx->task_list.first && if (data_race(!tctx->task_list.first) &&
!tctx->prior_task_list.first && uring_locked) data_race(!tctx->prior_task_list.first) && uring_locked)
io_submit_flush_completions(ctx); io_submit_flush_completions(ctx);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment