lib: cgen: batch-load map elements in a single syscall #542
Merged
Conversation
Claude review of PR #542 (df4fdda)Suggestions
|
df4fdda to
27ce007
Compare
qdeslandes
requested changes
May 13, 2026
Contributor
qdeslandes
left a comment
There was a problem hiding this comment.
This is a great addition, a few nits, but otherwise LGTM!
For reference, the benchmark CI job shares the report as artifact, here's the results before (main) and after (PR):
| Name | Before | After |
|---|---|---|
| load chain, ip4.saddr, 8 elements set | 9.17ms | 9.83ms |
| load chain, ip4.saddr, 65536 elements set | 159.79ms | 69.99ms |
| load chain, ip4.saddr, 1048576 elements set | 2913.68ms | 1584.11ms |
That's a very good addition!
20b6fa7 to
19ed706
Compare
qdeslandes
approved these changes
May 14, 2026
Contributor
qdeslandes
left a comment
There was a problem hiding this comment.
Awesome, thanks for fixing this! :D
Contributor
|
@pzmarzly I miss clicked and GitHub created a merge commit :( Could you remove it so I can merge the branch? Thanks! |
Build keys and bitmask values in user space and submit them all at once with one bf_bpf_map_update_batch() call. A bf_hashset is used to deduplicate entries.
2588252 to
c892fa4
Compare
Contributor
Author
|
No problem. Rebased. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will once again make us load entire BPF map in one syscall, after #520 changed them to load with 2n syscalls. We'll compute the desired shape on userspace side, and use
bf_bpf_map_update_batchto load it into kernelspace.Benchmark
Before #520 (I
git revert-ed it and let AI fix merge conflicts):Trunk:
With this PR: