Re: [PATCH] bpf: Call cond_resched() to avoid soft lockup in trie_free()
From: Alexei Starovoitov
Date: Tue Jun 17 2025 - 12:07:12 EST
On Tue, Jun 17, 2025 at 2:43 AM Matt Fleming <matt@xxxxxxxxxxxxxxxx> wrote:
>
> On Mon, Jun 16, 2025 at 4:51 PM Song Liu <song@xxxxxxxxxx> wrote:
> >
> > On Mon, Jun 16, 2025 at 2:55 AM Matt Fleming <matt@xxxxxxxxxxxxxxxx> wrote:
> > >
> > > From: Matt Fleming <mfleming@xxxxxxxxxxxxxx>
> > >
> > > Calls to kfree() in trie_free() can be expensive for KASAN-enabled
> > > kernels. This can cause soft lockup warnings when traversing large maps,
> >
> > I think this could also happen to KASAN-disabled kernels, so the commit log
> > is a bit misleading.
>
> This issue can definitely affect KASAN-disabled kernels.
>
> I mentioned KASAN to give context and explain why I saw this and
> nobody else seems to have reported it. I'm happy to reword this part
> of the commit message if needed but I still think it should mention
> KASAN somewhere because that's the reason I discovered it.
kfree is so slow that it triggers softlock up ?
> soft lockup - CPU#41 stuck for 76s
How many elements are in the trie that it takes 76 seconds??
I feel the issue is different.
It seems the trie_free() algorithm doesn't scale.
Pls share a full reproducer.
pw-bot: cr