Skip to contentSkip to conversation

cgroup: rstat: Mark benign data race to silence KCSAN

PATCH Applied Michal Koutný 3 participants 3 messages Nov 3, 2021 – Nov 15, 2021 cgroup

lore
Share & tools
lore

Michal Koutný

author maintainer
#0 lore raw

PATCH 1/1 cgroup: rstat: Mark benign data race to silence KCSAN

There is a race between updaters and flushers (flush can possibly miss the latest update(s)). This is expected as explained in cgroup_rstat_updated() comment, add also machine readable annotation so that KCSAN results aren't noisy.

---
 kernel/cgroup/rstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hao was silent in the reporting mail thread, so I'm sending the suggested annotating patch.

kernel/cgroup/rstat.c +1 -1
index 1486768f2318..1abe74114527 100644
@@ -35,7 +35,7 @@ void cgroup_rstat_updated(struct cgroup *cgrp, int cpu)
 	 * instead of NULL, we can tell whether @cgrp is on the list by
 	 * testing the next pointer for NULL.
 	 */
-	if (cgroup_rstat_cpu(cgrp, cpu)->updated_next)
+	if (data_race(cgroup_rstat_cpu(cgrp, cpu)->updated_next))
 		return;
 
 	raw_spin_lock_irqsave(cpu_lock, flags);
Signature · 1 line
2.33.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Michal Koutný

There is a race between updaters and flushers (flush can possibly miss the latest update(s)). This is expected as explained in cgroup_rstat_updated() comment, add also machine readable annotation so that KCSAN results aren't noisy.

maintainer Applied
#2 lore raw
In reply to Michal Koutný
Quoted 10 lines · Michal Koutný

There is a race between updaters and flushers (flush can possibly miss the latest update(s)). This is expected as explained in cgroup_rstat_updated() comment, add also machine readable annotation so that KCSAN results aren't noisy.

Applied to cgroup/for-5.17.

Thanks.

Signature · 1 line
tejun