Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate unneeded interlocked operation on LPM updates #3239

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

Alan-Jowett
Copy link
Member

Description

LPM tracks prefix lengths stored in the hash-table via a bitmap. This bitmap is only ever added to (never removed) so unconditionally doing an interlocked test and set is excessive.

Possibly related to: #3016

Testing

CI/CD

Documentation

No.

Installation

No.

@Alan-Jowett Alan-Jowett added this pull request to the merge queue Feb 5, 2024
Merged via the queue into microsoft:main with commit 060033c Feb 5, 2024
76 checks passed
@Alan-Jowett Alan-Jowett deleted the limit_interlocked_lpm branch February 5, 2024 23:55
@@ -1651,7 +1651,10 @@ _update_lpm_map_entry(

ebpf_result_t result = _update_hash_map_entry(map, key, data, option);
if (result == EBPF_SUCCESS) {
ebpf_bitmap_set_bit((ebpf_bitmap_t*)trie_map->data, prefix_length, true);
// Test if the bit is set before setting it. This avoids the overhead of a the interlocked operation.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Alan-Jowett Please fix grammar around "a the"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants