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

map: don't unmarshal unnecessary items on batch lookup #1080

Open
ti-mo opened this issue Jun 27, 2023 · 1 comment
Open

map: don't unmarshal unnecessary items on batch lookup #1080

ti-mo opened this issue Jun 27, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@ti-mo
Copy link
Collaborator

ti-mo commented Jun 27, 2023

It does seem like Map.batchLookup() always tries to unmarshal the whole keyBuf and valueBuf regardless of the Count received from the batch syscall.

ebpf/map.go

Lines 1076 to 1083 in c739d15

err := sysenc.Unmarshal(keysOut, keyBuf)
if err != nil {
return 0, err
}
err = sysenc.Unmarshal(valuesOut, valueBuf)
if err != nil {
return 0, err
}

It would be nice if we instead only decoded count keys and values.

See #1078 (comment).

@lmb lmb changed the title Batch: only unmarshal as much as needed map: don't unmarshal unnecessary items on batch lookup Dec 5, 2023
@lmb lmb added the help wanted Extra attention is needed label Dec 5, 2023
@Hudsoncoutinho
Copy link

err := sysenc.Desempacotamento(keysOut, keyBuf, count)
if err != nil {
return 0, err
}
err = sysenc.Desempacotamento(valuesOut, valueBuf, count)
if err != nil {
return 0, err
}

I thought about providing the actual count of items that need to be unpacked, storing it in the variable count, therefore, the Desempacotamento function needs to be able to accept an item count. If this is not supported, one option would be to adjust the function so that it receives this parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants