Skip to content

Commit

Permalink
Speedup ebpf_handle_table_terminate by avoiding acquire/release of lock
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett (from Dev Box) <[email protected]>
  • Loading branch information
Alan-Jowett authored and Alan Jowett committed Jun 17, 2024
1 parent c3bff13 commit 155519a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/runtime/user/ebpf_handle_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ ebpf_handle_table_terminate()
EBPF_RETURN_VOID();
}

ebpf_lock_state_t state;
state = ebpf_lock_lock(&_ebpf_handle_table_lock);
for (handle = 0; handle < EBPF_COUNT_OF(_ebpf_handle_table); handle++) {
// Ignore invalid handle close.
(void)ebpf_handle_close(handle);
if (_ebpf_handle_table[handle] != NULL) {
EBPF_OBJECT_RELEASE_REFERENCE_INDIRECT(_ebpf_handle_table[handle]);
_ebpf_handle_table[handle] = NULL;
}
}
ebpf_lock_unlock(&_ebpf_handle_table_lock, state);
_ebpf_handle_table_initiated = false;
EBPF_RETURN_VOID();
}
Expand Down

0 comments on commit 155519a

Please sign in to comment.