bpf, net: Use bpf mem allocator for sk local storage
Subsystems (3)
PATCH 1/1 bpf, net: Use bpf mem allocator for sk local storage
From: Kui-Feng Lee <[email protected]>
Switching to BPF memory allocator improve the performance of sk local storage in terms of creating and destroying.
Here is numbers w/ and w/o this changes.
- ./bench local-storage-create --storage-type=socket
- w/ change
- creates 552.474 ± 1.186k/s (552.474k/prod), 2.10 kmallocs/create
- w/o change
- creates 469.960 ± 2.501k/s (469.960k/prod), 4.18 kmallocs/create
- ./bench -p 4 local-storage-create --storage-type=socket
- w/ change
- creates 1236.614 ± 2.833k/s (309.153k/prod), 2.09 kmallocs/create
- w/o change
- creates 1120.524 ± 1.527k/s (280.131k/prod), 4.16 kmallocs/create
- ./bench -p 4 local-storage-create --storage-type=socket \
--batch-size=1024 - w/ change
- creates 1416.437 ± 37.679k/s (354.109k/prod), 2.06 kmallocs/create
- w/o change
- creates 1302.636 ± 13.649k/s (325.659k/prod), 4.12 kmallocs/create
Overall, with bpf memory allocator, it improves
- 17% for single thread and with batch size 32,
- 10% for 4 threads and with batch size 32, and
- 8% for 4 threads and with batch size 1024.
--- net/core/bpf_sk_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/bpf_sk_storage.c +1 -1
@@ -68,7 +68,7 @@ static void bpf_sk_storage_map_free(struct bpf_map *map)static struct bpf_map *bpf_sk_storage_map_alloc (union bpf_attr *attr) { -return bpf_local_storage_map_alloc (attr, &sk_cache, false); +return bpf_local_storage_map_alloc (attr, &sk_cache, true); } static int notsupp_get_next_key(struct bpf_map *map, void *key,
Signature · 1 line
2.34.1