mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cgroup: rstat: Mark benign data race to silence KCSAN
@ 2021-11-03 16:58 Michal Koutný
  2021-11-03 17:39 ` Shakeel Butt
  2021-11-15 21:34 ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Koutný @ 2021-11-03 16:58 UTC (permalink / raw)
  To: cgroups; +Cc: Johannes Weiner, Li Zefan, Tejun Heo, Hao Sun, linux-kernel

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>
---
 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.

diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
index 1486768f2318..1abe74114527 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);
-- 
2.33.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cgroup: rstat: Mark benign data race to silence KCSAN
  2021-11-03 16:58 [PATCH] cgroup: rstat: Mark benign data race to silence KCSAN Michal Koutný
@ 2021-11-03 17:39 ` Shakeel Butt
  2021-11-15 21:34 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Shakeel Butt @ 2021-11-03 17:39 UTC (permalink / raw)
  To: Michal Koutný
  Cc: cgroups, Johannes Weiner, Li Zefan, Tejun Heo, Hao Sun, linux-kernel

On Wed, Nov 3, 2021 at 9:59 AM Michal Koutný <mkoutny@suse.com> wrote:
>
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cgroup: rstat: Mark benign data race to silence KCSAN
  2021-11-03 16:58 [PATCH] cgroup: rstat: Mark benign data race to silence KCSAN Michal Koutný
  2021-11-03 17:39 ` Shakeel Butt
@ 2021-11-15 21:34 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2021-11-15 21:34 UTC (permalink / raw)
  To: Michal Koutný
  Cc: cgroups, Johannes Weiner, Li Zefan, Hao Sun, linux-kernel

On Wed, Nov 03, 2021 at 05:58:45PM +0100, Michal Koutný wrote:
> 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>

Applied to cgroup/for-5.17.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-16  0:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 16:58 [PATCH] cgroup: rstat: Mark benign data race to silence KCSAN Michal Koutný
2021-11-03 17:39 ` Shakeel Butt
2021-11-15 21:34 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®