Skip to content

Commit

Permalink
cgroup: rstat: Mark benign data race to silence KCSAN
Browse files Browse the repository at this point in the history
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>

Signed-off-by: Michal Koutný <mkoutny@suse.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Michal Koutný authored and Tejun Heo committed Nov 15, 2021
1 parent 8ab7745 commit eda0970
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/cgroup/rstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit eda0970

Please sign in to comment.