Re: [PATCH bpf v3] bpf: Fix RCU stall in bpf_fd_array_map_clear()

From: Sechang Lim

Date: Tue Mar 31 2026 - 03:26:54 EST


On 31/3/26 13:19, Leon Hwang wrote:
> 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.

You're right, I should have just pinged v2 instead of sending v3.
The only change was fixing a CC typo (eddyz78 -> eddyz87), no
functional change. Apologies for the missing changelog as well.

> 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?

map_poke_run is only set in prog_array_map_ops, so the
expensive path (poke_mutex + map_poke_run) in
__fd_array_map_delete_elem() is exclusive to prog_array.
For perf_event_array, cgroup_array, and array_of_map, each
iteration is just xchg + put_ptr, which is lightweight enough
that cond_resched() will not trigger rescheduling in practice.

Thanks,
Sechang