Skip to content

Conversation

@kyledong-suse
Copy link
Contributor

Description

Enable BPF_F_NO_PREALLOC flag for the inner per-policy maps(policy_%d_map). Currently it uses a fixed size(32768) and the default preallocated hash map mode.

This commit will optimize the pre-allocation memory only for actual entries, which will reduce the footprint.

Fixes: #4249

Enable BPF_F_NO_PREALLOC flag for the inner per-policy maps(policy_%d_map).
Currently it uses a fixed size(32768) and the default preallocated hash map
mode.

This commit will optimize the pre-allocation memory only for actual entries,
which will reduce the footprint.

Fixes: cilium#4249
Signed-off-by: Kyle Dong <[email protected]>
@kyledong-suse kyledong-suse requested a review from a team as a code owner November 13, 2025 16:50
@kyledong-suse kyledong-suse requested a review from FedeDP November 13, 2025 16:50
@kkourt kkourt added the release-note/minor This PR introduces a minor user-visible change label Nov 17, 2025
@netlify
Copy link

netlify bot commented Nov 17, 2025

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 100c6e6
🔍 Latest deploy log https://app.netlify.com/projects/tetragon/deploys/691b418eb6361b000811a84c
😎 Deploy Preview https://deploy-preview-4340--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Add a user-configurable knob enable-policy-filter-no-prealloc.
With this flag, users can choose whether to enable or disable
BPF_F_NO_PREALLOC for the inner policy maps, depending on their needs.

Signed-off-by: Kyle Dong <[email protected]>
@kyledong-suse kyledong-suse force-pushed the pr/kyledong-suse/optimize-inner-policy-maps-memory-usage branch from 24d75a6 to 100c6e6 Compare November 17, 2025 15:38
Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me but let's see if that would be better to have a global flag instead of a per map flag for NO_PREALLOC disable since you mentioned another map in the issue. I'm really not sure which one is best 🤔

We could even extend this flag to the map we already have using no_prealloc, but maybe that's too much for this patch set and out of scope!

@kyledong-suse
Copy link
Contributor Author

Thanks for taking time to review this PR @mtardy!
Let's wait @kkourt for his comment about this idea.
If you all agree to have a generic flag to enable/disable BPF_F_NO_PREALLOC, I can modify the title of the issue as well as this PR and commit messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/minor This PR introduces a minor user-visible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize inner policy maps with BPF_F_NO_PREALLOC to reduce memory usage

3 participants