Re: [PATCH] llist: add [READ|WRITE]_ONCE tags for llist_node

From: Tejun Heo
Date: Thu Jun 26 2025 - 20:15:54 EST


Hello,

On Thu, Jun 26, 2025 at 04:38:18PM -0700, Shakeel Butt wrote:
> diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
> index c8a48cf83878..02258b43abb3 100644
> --- a/kernel/cgroup/rstat.c
> +++ b/kernel/cgroup/rstat.c
> @@ -86,8 +86,12 @@ __bpf_kfunc void css_rstat_updated(struct cgroup_subsys_state *css, int cpu)
> return;
>
> rstatc = css_rstat_cpu(css, cpu);
> - /* If already on list return. */
> - if (llist_on_list(&rstatc->lnode))
> + /*
> + * If already on list return.
> + *
> + * TODO: add detailed comment on the potential race.
> + */
> + if (data_race(llist_on_list(&rstatc->lnode)))
> return;

Yeah, also in the functdion comment, explain that if avoiding such races is
important enough to justify the overhead, the caller can put smp_mb() before
calling css_rstat_updated().

Thanks.

--
tejun