From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: cgroups@vger.kernel.org
Cc: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com,
linux-kernel@vger.kernel.org,
Jiayuan Chen <jiayuan.chen@linux.dev>
Subject: [PATCH v1] cgroup: drop preemption_disabled checking
Date: Wed, 19 Nov 2025 19:14:01 +0800 [thread overview]
Message-ID: <20251119111402.153727-1-jiayuan.chen@linux.dev> (raw)
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, so checking
for disabled preemption is unnecessary (please correct me if I'm wrong).
[1]:
~/tools/testing/selftests/bpf$
test_progs -a cgroup_hierarchical_stats
...
------------[ cut here ]------------
WARNING: CPU: 0 PID: 382 at kernel/cgroup/rstat.c:84
Modules linked in:
RIP: 0010:css_rstat_updated+0x9d/0x160
...
PKRU: 55555554
Call Trace:
<TASK>
bpf_prog_16a1c2d081688506_counter+0x143/0x14e
bpf_trampoline_6442524909+0x4b/0xb7
cgroup_attach_task+0x5/0x330
? __cgroup_procs_write+0x1d7/0x2f0
cgroup_procs_write+0x17/0x30
cgroup_file_write+0xa6/0x2d0
kernfs_fop_write_iter+0x188/0x240
vfs_write+0x2da/0x5a0
ksys_write+0x77/0x100
__x64_sys_write+0x19/0x30
x64_sys_call+0x79/0x26a0
do_syscall_64+0x89/0x790
? irqentry_exit+0x77/0xb0
? __this_cpu_preempt_check+0x13/0x20
? lockdep_hardirqs_on+0xce/0x170
? irqentry_exit_to_user_mode+0xf2/0x290
? irqentry_exit+0x77/0xb0
? clear_bhb_loop+0x50/0xa0
? clear_bhb_loop+0x50/0xa0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
---[ end trace 0000000000000000 ]---
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
---
kernel/cgroup/rstat.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
index a198e40c799b..fe0d22280cbd 100644
--- a/kernel/cgroup/rstat.c
+++ b/kernel/cgroup/rstat.c
@@ -81,8 +81,6 @@ __bpf_kfunc void css_rstat_updated(struct cgroup_subsys_state *css, int cpu)
if (!css_uses_rstat(css))
return;
- lockdep_assert_preemption_disabled();
-
/*
* For archs withnot nmi safe cmpxchg or percpu ops support, ignore
* the requests from nmi context.
--
2.43.0
next reply other threads:[~2025-11-19 11:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 11:14 Jiayuan Chen [this message]
2025-11-19 15:59 ` [PATCH v1] cgroup: drop preemption_disabled checking Tejun Heo
2025-11-20 1:57 ` Jiayuan Chen
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=20251119111402.153727-1-jiayuan.chen@linux.dev \
--to=jiayuan.chen@linux.dev \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.