From: Michal Koutný Date: Wed, 3 Nov 2021 16:58:45 +0000 (+0100) Subject: cgroup: rstat: Mark benign data race to silence KCSAN X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=eda09706b240ca9129ac4e1fbb4eb1e2bc67aadc;p=linux.git 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 Link: https://lore.kernel.org/r/CACkBjsbPVdkub=e-E-p1WBOLxS515ith-53SFdmFHWV_QMo40w@mail.gmail.com Suggested-by: Hao Sun Signed-off-by: Michal Koutný Reviewed-by: Shakeel Butt Signed-off-by: Tejun Heo --- diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index 1486768f23185..1abe741145271 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -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);