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

ioctl: allow common operations without allocations #3726

Open
lmb opened this issue Jul 23, 2024 · 1 comment
Open

ioctl: allow common operations without allocations #3726

lmb opened this issue Jul 23, 2024 · 1 comment
Assignees
Labels
optimization Affects perf but not correctness or applicability P2 triaged Discussed in a triage meeting
Milestone

Comments

@lmb
Copy link
Contributor

lmb commented Jul 23, 2024

Describe the feature you'd like supported

Operations like looking up a map value via EBPF_OPERATION_MAP_FIND_ELEMENT are currently forced to allocate a buffer because of the way that the request structure is defined:

typedef struct _ebpf_operation_map_find_element_request
{
struct _ebpf_operation_header header;
ebpf_handle_t handle;
bool find_and_delete;
uint8_t key[1];
} ebpf_operation_map_find_element_request_t;

The key is appended to the request buffer. This means that the caller has to allocate memory and perform copying. This is especially bad for batch operations where the amount if memory to be allocated and copied is larger:

typedef struct _ebpf_operation_map_update_element_batch_request
{
struct _ebpf_operation_header header;
ebpf_handle_t handle;
ebpf_map_option_t option;
// Count of elements is derived from the length of the request.
// Data is a concatenation of key+value.
uint8_t data[1];
} ebpf_operation_map_update_element_batch_request_t;

It would be nice if common performance critical map operations could be implemented without allocations.

Proposed solution

This could be achieved by making map keys and values pointers, like it is done for struct bpf_prog_info:

uintptr_t map_ids; ///< Pointer to caller-allocated array to fill map IDs into.

Additional context

No response

@lmb lmb added the enhancement New feature or request label Jul 23, 2024
@shankarseal shankarseal added optimization Affects perf but not correctness or applicability P2 and removed enhancement New feature or request labels Jul 29, 2024
@shankarseal shankarseal added this to the 2409 milestone Jul 29, 2024
@jrfastab
Copy link

I'll take a look at performance here once we get Tetragon up and running so we cant est.

@shankarseal shankarseal added the triaged Discussed in a triage meeting label Jul 29, 2024
@shankarseal shankarseal modified the milestones: 2409, 2410 Aug 2, 2024
@shankarseal shankarseal modified the milestones: 2410, 2411 Sep 9, 2024
@shankarseal shankarseal modified the milestones: 2411, 2501 Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Affects perf but not correctness or applicability P2 triaged Discussed in a triage meeting
Projects
None yet
Development

No branches or pull requests

3 participants