diff options
author | 2025-02-20 12:22:59 +0800 | |
---|---|---|
committer | 2025-02-20 18:39:38 -0800 | |
commit | b4a8b5bba712a711d8ca1f7d04646db63f9c88f5 (patch) | |
tree | 4154615e889fae2c872e5044e49acccafa3a876e /tools/lib/bpf/linker.c | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf bpf-6.14-rc4 (diff) | |
download | wireguard-linux-b4a8b5bba712a711d8ca1f7d04646db63f9c88f5.tar.xz wireguard-linux-b4a8b5bba712a711d8ca1f7d04646db63f9c88f5.zip |
bpf: Use preempt_count() directly in bpf_send_signal_common()
bpf_send_signal_common() uses preemptible() to check whether or not the
current context is preemptible. If it is preemptible, it will use
irq_work to send the signal asynchronously instead of trying to hold a
spin-lock, because spin-lock is sleepable under PREEMPT_RT.
However, preemptible() depends on CONFIG_PREEMPT_COUNT. When
CONFIG_PREEMPT_COUNT is turned off (e.g., CONFIG_PREEMPT_VOLUNTARY=y),
!preemptible() will be evaluated as 1 and bpf_send_signal_common() will
use irq_work unconditionally.
Fix it by unfolding "!preemptible()" and using "preempt_count() != 0 ||
irqs_disabled()" instead.
Fixes: 87c544108b61 ("bpf: Send signals asynchronously if !preemptible")
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20250220042259.1583319-1-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/linker.c')
0 files changed, 0 insertions, 0 deletions