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

Partition epoch thread list #436

Merged
merged 4 commits into from
Aug 27, 2021
Merged

Conversation

Alan-Jowett
Copy link
Member

Partition epoch thread list.
Perform memory-free on epoch_exit.

Resolves: #417

Signed-off-by: Alan Jowett [email protected]

@Alan-Jowett
Copy link
Member Author

Please double-check my logic around merging the per-thread state into a unified view. It seems to be correct, but I had several bugs in it prior to this version.

libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
Perform memory free on epoch_exit

Signed-off-by: Alan Jowett <[email protected]>
@Alan-Jowett
Copy link
Member Author

Without fix for #417
perf_epoch_enter_exit:3590ns
perf_ebpf_hash_table_find:3563ns
perf_ebpf_hash_table_next_key:3596ns
perf_ebpf_hash_table_update:1613ns

With fix for #417
perf_epoch_enter_exit:9ns
perf_ebpf_hash_table_find:10ns
perf_ebpf_hash_table_next_key:11ns
perf_ebpf_hash_table_update:92ns

Copy link
Collaborator

@dthaler dthaler left a comment

Choose a reason for hiding this comment

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

Ok modulo SAL annotation nits

libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.c Outdated Show resolved Hide resolved
libs/platform/ebpf_epoch.h Outdated Show resolved Hide resolved
Signed-off-by: Alan Jowett <[email protected]>
Signed-off-by: Alan Jowett <[email protected]>
EBPF_HASH_TABLE_OPERATION_INSERT);
} else if (local_result == EBPF_SUCCESS) {
// Found, merge the global and per-CPU entry.
new_thread_entry->entry_epoch = max(new_thread_entry->entry_epoch, thread_entry->entry_epoch);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Non blocking Suggestion: consider updating the lowest_epoch here itself? Will save another scan through the merged hashtable after this.

cpu_entry->epoch = _ebpf_current_epoch;
cpu_entry->non_preemptible_epoch = _ebpf_current_epoch;
if (!ebpf_list_is_empty(&cpu_entry->free_list)) {
_ebpf_epoch_release_free_list(cpu_entry, _ebpf_release_epoch);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Non blocking: Wonder if _release_free_list function should re-arm the GC timer? Consider the case - where this function calls _release_free_list - but it may not be able to free all zombie entries if another thread on another CPU is actively using it. When that other CPU exits epoch, it may not find any non-empty free list on its core - so no timers are scheduled. And the zombie entries on this CPU lingers on. I believe this is a bug and must be addressed by another PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Issue #445

Signed-off-by: Alan Jowett <[email protected]>
@Alan-Jowett Alan-Jowett merged commit f5e18cd into microsoft:master Aug 27, 2021
@Alan-Jowett Alan-Jowett deleted the issue417 branch August 28, 2021 18:41
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.

ebpf_epoch's _ebpf_epoch_thread_table_lock causes significant contention
3 participants