[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6cd2dc59-e647-411f-ba3e-2a741487abb8@redhat.com>
Date: Fri, 21 Nov 2025 00:07:47 -0500
From: Waiman Long <llong@...hat.com>
To: Jiayuan Chen <jiayuan.chen@...ux.dev>, cgroups@...r.kernel.org
Cc: tj@...nel.org, hannes@...xchg.org, mkoutny@...e.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] cgroup: Add preemption protection to
css_rstat_updated()
On 11/20/25 11:06 PM, Jiayuan Chen wrote:
> BPF programs do not disable preemption, they only disable migration.
> Therefore, when running the cgroup_hierarchical_stats selftest, a
> warning [1] is generated.
>
> The css_rstat_updated() function is lockless and reentrant. However,
> as Tejun pointed out [2], preemption-related considerations need to
> be considered. Since css_rstat_updated() can be called from BPF where
> preemption is not disabled by its framework and it has already been
> exposed as a kfunc to BPF programs, introducing a new kfunc like bpf_xx
> will break existing uses. Thus, we directly make css_rstat_updated()
> preempt-safe here.
My understand of Tejun's comment is to add bpf_preempt_disable() and
bpf_preempt_enable() calls around the css_rstat_updated() call in the
bpf program defined in
tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c
instead of adding that in the css_rstat_updated() function itself. But I
may be wrong.
Cheers, Longman
Powered by blists - more mailing lists