[PATCH bpf] bpf: do not use kmalloc_nolock when !HAVE_CMPXCHG_DOUBLE
bot+bpf-ci at kernel.org
bot+bpf-ci at kernel.org
Sat Mar 14 04:09:33 PDT 2026
> diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c
> index 9c96a4477f81..8e4b0fe6d12a 100644
> --- a/kernel/bpf/bpf_local_storage.c
> +++ b/kernel/bpf/bpf_local_storage.c
> @@ -894,7 +894,8 @@ bpf_local_storage_map_alloc(union bpf_attr *attr,
> * preemptible context. Thus, enforce all storages to use
> * kmalloc_nolock() when CONFIG_PREEMPT_RT is enabled.
> */
> - smap->use_kmalloc_nolock = IS_ENABLED(CONFIG_PREEMPT_RT) ? true : use_kmalloc_nolock;
> + smap->use_kmalloc_nolock = IS_ENABLED(CONFIG_PREEMPT_RT) &&
> + KMALLOC_NOLOCK_SUPPORTED ? true : use_kmalloc_nolock;
Should the comment above be updated to reflect the new behavior?
It currently says "enforce all storages to use kmalloc_nolock()
when CONFIG_PREEMPT_RT is enabled", but the code now only enforces
kmalloc_nolock when both CONFIG_PREEMPT_RT and
CONFIG_HAVE_CMPXCHG_DOUBLE are enabled. On PREEMPT_RT without
HAVE_CMPXCHG_DOUBLE, the override is silently skipped and the
caller's value is used instead.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/23086356774
More information about the linux-riscv
mailing list