microsoft / microsoft/ebpf-for-windows

Add support for ebpf_hash_table_t with preallocated buckets

Open
#2,817 0 comments 0 reactions 0 assignees View on GitHub
help wanted optimization triaged
Dominant language
C
Stars
3.6k
Forks
311
Avg merge
6d 10h
Merged PRs (30d)
21

Description

Up to 50% of map update is due to pool allocations.

It might be possible to reduce this if we preallocate the buckets.

Algorithm:
1) Allocate an array of 1 entry buckets.
2) Each entry in the array has a released epoch.
3) If released epoch == UINT64_MAX, then the bucket is busy.
4) If (bucket's release epoch <= global release epoch), then it can be reused, mark release epoch == UINT64_MAX.
5) When freeing a bucket, if it's the preallocated bucket, set release epoch == global current epoch.

Buckets can then be in 3 states:
1) In use - release epoch == UINT64_MAX.
2) Waiting to be reused - release epoch > global release epoch.
3) Ready to be reused - release epoch <= global release epoch.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the map update path and the pool allocation work described in the issue. Assess how preallocated one-entry buckets would interact with release epochs, including the in-use, waiting, and reusable states. Done means map updates avoid eligible pool allocations while preserving safe bucket reuse.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.