Re: [PATCH] memcg: Fix data-race KCSAN bug in rstats

From: Breno Leitao
Date: Tue May 07 2024 - 12:07:12 EST


Hello Michal,

On Fri, May 03, 2024 at 01:27:41PM +0200, Michal Hocko wrote:
> On Wed 24-04-24 05:59:39, Breno Leitao wrote:
> > The race occurs because two code paths access the same "stats_updates"
> > location. Although "stats_updates" is a per-CPU variable, it is remotely
> > accessed by another CPU at
> > cgroup_rstat_flush_locked()->mem_cgroup_css_rstat_flush(), leading to
> > the data race mentioned.
>
> It is worth mentioning that the race is harmless.

Are you suggesting that the race consistently avoids producing corrupt
data, or even if corruption occurs, it's inconsequential because it only
affects statistics?

If there's no data corruption, does it incur any performance drawbacks?

Thanks!