Hi, On 7/21/2023 10:31 AM, YiFei Zhu wrote: > On Thu, Jul 20, 2023 at 6:45 PM Hou Tao <houtao@xxxxxxxxxxxxxxx> wrote: >> On 7/21/2023 4:44 AM, YiFei Zhu wrote: >>> Sometimes during prefill all precpu chunks are full and atomic >>> __alloc_percpu_gfp would not allocate new chunks. This will cause >>> -ENOMEM immediately upon next unit_alloc. >>> >>> Prefill phase does not actually run in atomic context, so we can >>> use this fact to allocate non-atomically with GFP_KERNEL instead >>> of GFP_NOWAIT. This avoids the immediate -ENOMEM. Unfortunately >>> unit_alloc runs in atomic context, even from map item allocation in >>> syscalls, due to rcu_read_lock, so we can't do non-atomic >>> workarounds in unit_alloc. >>> >>> Fixes: 4ab67149f3c6 ("bpf: Add percpu allocation support to bpf_mem_alloc.") >>> Signed-off-by: YiFei Zhu <zhuyifei@xxxxxxxxxx> >> Make sense to me, so >> >> Acked-by: Hou Tao <houtao1@xxxxxxxxxx> >> >> But I don't know whether or not it is suitable for bpf tree. > I don't mind either way :) If changing to bpf-next requires a resend I > can do that too. Please resend and rebase the patch again bpf-next tree.