Re: [PATCH bpf v3] bpf: Fix RCU stall in bpf_fd_array_map_clear()
From: Leon Hwang
Date: Tue Mar 31 2026 - 01:20:10 EST
On 31/3/26 10:30, Sechang Lim wrote:
[...]
> Reviewed-by: Sun Jian <sun.jian.kdev@xxxxxxxxx>
> Fixes: da765a2f5993 ("bpf: Add poke dependency tracking for prog array maps")
> Signed-off-by: Sechang Lim <rhkrqnwk98@xxxxxxxxx>
> ---
After looking at v2, there's no functional change for v2 -> v3.
I think, you should send a PING in v2 after some days instead of sending
v3. If v2 will be applied, the tag will be picked up btw.
Besides, change logs are missing here.
v2 -> v3:
* ...
v2: [its lore link]
v1 -> v2:
* ...
v1: [its lore link]
Also, you should check sashiko's review [1].
[1]
https://sashiko.dev/#/patchset/20260331023056.484354-1-rhkrqnwk98%40gmail.com
> kernel/bpf/arraymap.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
> index 33de68c95..5e25e0353 100644
> --- a/kernel/bpf/arraymap.c
> +++ b/kernel/bpf/arraymap.c
> @@ -1015,8 +1015,10 @@ static void bpf_fd_array_map_clear(struct bpf_map *map, bool need_defer)
> struct bpf_array *array = container_of(map, struct bpf_array, map);
> int i;
>
> - for (i = 0; i < array->map.max_entries; i++)
> + for (i = 0; i < array->map.max_entries; i++) {
> __fd_array_map_delete_elem(map, &i, need_defer);
> + cond_resched();
Since bpf_fd_array_map_clear() is used across prog_array,
perf_event_array, cgroup_array, and array_of_map, and this patch aims to
avoid RCU stalls for prog_array, does this cond_resched() punish
perf_event_array, cgroup_array, and array_of_map?
Thanks,
Leon
> + }
> }
>
> static void prog_array_map_seq_show_elem(struct bpf_map *map, void *key,