From: Richard Cheng <icheng@nvidia.com>
To: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com,
martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
jolsa@kernel.org, emil@etsalapatis.com
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
newtonl@nvidia.com, kristinc@nvidia.com, kaihengf@nvidia.com,
kobak@nvidia.com, Richard Cheng <icheng@nvidia.com>
Subject: [PATCH] bpf: Run deferred program freeing on system_dfl_long_wq
Date: Mon, 20 Jul 2026 11:31:35 +0800 [thread overview]
Message-ID: <20260720033135.62223-1-icheng@nvidia.com> (raw)
Destroying APT's seccomp BPF programs can spend over 20ms in arm64 JIT
text invalidation. bpf_jit_free() calls kick_all_cpus_sync(), which is
especially expensive on system with many CPUs.
schedule_work() uses a per-CPU workqueue, causing:
"""
[204351.169849] workqueue: bpf_prog_free_deferred hogged CPU for
>20000us 5 times, consider switching to WQ_UNBOUND
"""
This is triggered during a normal "sudo apt update -y"
Queue the cleanup on system_dfl_long_wq, the unbound queue intended for
long-running work, to avoid delaying concurrency-managed per-CPU
workers.
Signed-off-by: Richard Cheng <icheng@nvidia.com>
---
kernel/bpf/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 6e19a030da6f..a2ca6bdfb6f5 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -3115,7 +3115,7 @@ void bpf_prog_free(struct bpf_prog *fp)
bpf_prog_put(aux->dst_prog);
bpf_token_put(aux->token);
INIT_WORK(&aux->work, bpf_prog_free_deferred);
- schedule_work(&aux->work);
+ queue_work(system_dfl_long_wq, &aux->work);
}
EXPORT_SYMBOL_GPL(bpf_prog_free);
--
2.43.0
next reply other threads:[~2026-07-20 3:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 3:31 Richard Cheng [this message]
2026-07-27 22:49 ` [PATCH] bpf: Run deferred program freeing on system_dfl_long_wq Andrii Nakryiko
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=20260720033135.62223-1-icheng@nvidia.com \
--to=icheng@nvidia.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kaihengf@nvidia.com \
--cc=kobak@nvidia.com \
--cc=kristinc@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=newtonl@nvidia.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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