* [PATCH] block/blk-iocost: annotate committed flag with READ_ONCE/WRITE_ONCE
@ 2026-08-02 15:17 Tao Cui
0 siblings, 0 replies; only message in thread
From: Tao Cui @ 2026-08-02 15:17 UTC (permalink / raw)
To: tj, axboe; +Cc: josef, cgroups, linux-block, linux-kernel, cui.tao, Tao Cui
From: Tao Cui <cuitao@kylinos.cn>
The "committed" wait flag is written by iocg_wake_fn() under
waitq.lock and read by ioc_rqos_throttle() without the lock, which
trips KCSAN. The ordering is already handled by
set_current_state()/wake_up() so the race is harmless. Use
READ_ONCE()/WRITE_ONCE() to document the intentional lockless access.
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
---
block/blk-iocost.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 8b2aeba2e1e3..782bbe2d27b3 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -1458,7 +1458,7 @@ static int iocg_wake_fn(struct wait_queue_entry *wq_entry, unsigned mode,
return -1;
iocg_commit_bio(ctx->iocg, wait->bio, wait->abs_cost, cost);
- wait->committed = true;
+ WRITE_ONCE(wait->committed, true);
/*
* autoremove_wake_function() removes the wait entry only when it
@@ -2763,7 +2763,7 @@ static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio)
while (true) {
set_current_state(TASK_UNINTERRUPTIBLE);
- if (wait.committed)
+ if (READ_ONCE(wait.committed))
break;
io_schedule();
}
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-02 15:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-02 15:17 [PATCH] block/blk-iocost: annotate committed flag with READ_ONCE/WRITE_ONCE Tao Cui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox