]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bpf: Reset prog callback in bpf_async_cancel_and_free()
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Thu, 5 Feb 2026 00:38:53 +0000 (16:38 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 5 Feb 2026 02:14:26 +0000 (18:14 -0800)
Replace prog and callback in bpf_async_cb after removing visibility of
bpf_async_cb in bpf_async_cancel_and_free() to increase the chances the
scheduled async callbacks short-circuit execution and exit early, and
not starting a RCU tasks trace section. This improves the overall time
spent in running the wq selftest.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20260205003853.527571-3-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c

index b7aec34540c2894bd064a6d22756cc62e9a89cc6..a4f039cee88b62af7857f704caa1973d7152a4a9 100644 (file)
@@ -1664,6 +1664,7 @@ static void bpf_async_cancel_and_free(struct bpf_async_kern *async)
        if (!cb)
                return;
 
+       bpf_async_update_prog_callback(cb, NULL, NULL);
        /*
         * No refcount_inc_not_zero(&cb->refcnt) here. Dropping the last
         * refcnt. Either synchronously or asynchronously in irq_work.