History

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. Reported-by: Hao Sun <sunhao.th@gmail.com> Link: https://lore.kernel.org/r/CACkBjsbPVdkub=e-E-p1WBOLxS515ith-53SFdmFHWV_QMo40w@mail.gmail.com Suggested-by: Hao Sun <sunhao.th@gmail.com>

Michal Koutný committed 5 years ago

Commit eda09701 parent 8ab77451 file · +1 −1Browse files

Unified · Split

kernel/cgroup/rstat.c+1−1
@@ -35,7 +35,7 @@ void cgroup_rstat_updated(struct cgroup *cgrp, int cpu) · 34 unmodified lines
35 * instead of NULL, we can tell whether @cgrp is on the list by35 * instead of NULL, we can tell whether @cgrp is on the list by
36 * testing the next pointer for NULL.36 * testing the next pointer for NULL.
37 */37 */
38 if (cgroup_rstat_cpu(cgrp, cpu)->updated_next)38 if (data_race(cgroup_rstat_cpu(cgrp, cpu)->updated_next))
39 return;39 return;
40 40
41 raw_spin_lock_irqsave(cpu_lock, flags);41 raw_spin_lock_irqsave(cpu_lock, flags);