BPF List
 help / color / mirror / Atom feed
* [PATCH] bpf: Run deferred program freeing on system_dfl_long_wq
@ 2026-07-20  3:31 Richard Cheng
  0 siblings, 0 replies; only message in thread
From: Richard Cheng @ 2026-07-20  3:31 UTC (permalink / raw)
  To: ast, daniel, john.fastabend, andrii, eddyz87, memxor, martin.lau,
	song, yonghong.song, jolsa, emil
  Cc: bpf, linux-kernel, newtonl, kristinc, kaihengf, kobak,
	Richard Cheng

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-20  3:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20  3:31 [PATCH] bpf: Run deferred program freeing on system_dfl_long_wq Richard Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox