Linux cgroups development
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: Jiayuan Chen <jiayuan.chen@linux.dev>, cgroups@vger.kernel.org
Cc: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] cgroup: Add preemption protection to css_rstat_updated()
Date: Fri, 21 Nov 2025 00:07:47 -0500	[thread overview]
Message-ID: <6cd2dc59-e647-411f-ba3e-2a741487abb8@redhat.com> (raw)
In-Reply-To: <20251121040655.89584-1-jiayuan.chen@linux.dev>

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


  reply	other threads:[~2025-11-21  5:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  4:06 [PATCH v2] cgroup: Add preemption protection to css_rstat_updated() Jiayuan Chen
2025-11-21  5:07 ` Waiman Long [this message]
2025-11-21  6:21   ` Jiayuan Chen
2025-11-21 15:47     ` Waiman Long
2025-11-24  4:54       ` Shakeel Butt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cd2dc59-e647-411f-ba3e-2a741487abb8@redhat.com \
    --to=llong@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox