Skip to content

Commit 5000a09

Browse files
kkdwvdAlexei Starovoitov
authored andcommitted
bpf: Reset prog callback in bpf_async_cancel_and_free()
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>
1 parent 81502d7 commit 5000a09

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

kernel/bpf/helpers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,7 @@ static void bpf_async_cancel_and_free(struct bpf_async_kern *async)
16641664
if (!cb)
16651665
return;
16661666

1667+
bpf_async_update_prog_callback(cb, NULL, NULL);
16671668
/*
16681669
* No refcount_inc_not_zero(&cb->refcnt) here. Dropping the last
16691670
* refcnt. Either synchronously or asynchronously in irq_work.

0 commit comments

Comments
 (0)