Slow insertion of LPM map into HASH of maps (~20ms) #1297
-
Howdy! I've recently come across an issue where using I dont think the code is complicated and Im more than happy to hear Im just doing this wrong. But for the following code why would this take so long? struct bpf_map_def SEC("maps") policies_table = {
.type = BPF_MAP_TYPE_HASH_OF_MAPS,
.max_entries = MAX_MAP_ENTRIES,
.key_size = MAX_USERID_LENGTH,
.value_size = sizeof(__u32),
.map_flags = 0,
}; func addInnerMapTo(key interface{}, spec *ebpf.MapSpec, table *ebpf.Map) (*ebpf.Map, error) {
inner, err := ebpf.NewMap(spec)
if err != nil {
return nil, fmt.Errorf("%s creating new map: %s", table.String(), err)
}
err = table.Put(key, uint32(inner.FD()))
if err != nil {
return nil, fmt.Errorf("%s adding new map to table: %s", table.String(), err)
}
return inner, nil
} |
Beta Was this translation helpful? Give feedback.
Answered by
chenhengqi
Jan 8, 2024
Replies: 1 comment 6 replies
-
We've encounter similar situation in production, I think commit torvalds/linux@1ae80cf31938 is relevant. |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
lmb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We've encounter similar situation in production, I think commit torvalds/linux@1ae80cf31938 is relevant.