[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP01T76JECHPV4Fdvm2bds=Eb36UYhQswd7oAJ+fRzW_1ZtnVw@mail.gmail.com>
Date: Mon, 12 Jan 2026 19:15:14 +0100
From: Kumar Kartikeya Dwivedi <memxor@...il.com>
To: wujing <realwujing@...com>
Cc: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
john.fastabend@...il.com, martin.lau@...ux.dev, eddyz87@...il.com,
song@...nel.org, yonghong.song@...ux.dev, kpsingh@...nel.org, sdf@...ichev.me,
haoluo@...gle.com, jolsa@...nel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, Qiliang Yuan <yuanql9@...natelecom.cn>
Subject: Re: [PATCH] bpf/verifier: implement slab cache for verifier state list
On Mon, 12 Jan 2026 at 13:28, wujing <realwujing@...com> wrote:
>
> The BPF verifier's state exploration logic in is_state_visited()
> frequently allocates and deallocates 'struct bpf_verifier_state_list'
> nodes to track explored states and prune the search space.
>
> Currently, these allocations use generic kzalloc(), which can lead to
> unnecessary memory fragmentation and performance overhead when
> verifying high-complexity BPF programs with thousands of potential
> states.
>
> This patch introduces a dedicated slab cache, 'bpf_verifier_state_list',
> to manage these allocations more efficiently. This provides better
> allocation speed, reduced fragmentation, and improved cache locality
> during the verification process.
>
> Summary of changes:
> - Define global 'bpf_verifier_state_list_cachep'.
> - Initialize the cache via late_initcall() in bpf_verifier_init().
> - Use kmem_cache_zalloc() in is_state_visited() to allocate new states.
> - Replace kfree() with kmem_cache_free() in maybe_free_verifier_state(),
> is_state_visited() error paths, and free_states().
>
> Signed-off-by: wujing <realwujing@...com>
> Signed-off-by: Qiliang Yuan <yuanql9@...natelecom.cn>
> ---
>
Did you run any numbers on whether this improves verification performance?
Without any compelling evidence, I would leave things as-is.
Powered by blists - more mailing lists