kallsyms: cache bpf symbols to avoid quadratic iteration#10892
kallsyms: cache bpf symbols to avoid quadratic iteration#10892kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
Conversation
|
Upstream branch: 95dbe21 |
98e801d to
2209373
Compare
|
Upstream branch: b18a761 |
e7ddf21 to
c6ffc6e
Compare
2209373 to
5f55f4c
Compare
|
Upstream branch: cd77618 |
c6ffc6e to
3caad81
Compare
5f55f4c to
0706c41
Compare
|
Upstream branch: c7fbf8d |
3caad81 to
8deb2bd
Compare
0706c41 to
cb7b7a2
Compare
|
Upstream branch: cda0cbf |
8deb2bd to
f54fb89
Compare
cb7b7a2 to
d2ef468
Compare
|
Upstream branch: f0b5b3d |
f54fb89 to
551b1a3
Compare
d2ef468 to
e6f7b68
Compare
|
Upstream branch: 4bebb99 |
551b1a3 to
99e3a05
Compare
e6f7b68 to
af9bd6d
Compare
|
Upstream branch: 6b95cc5 |
99e3a05 to
69bc599
Compare
af9bd6d to
cecc6f5
Compare
|
Upstream branch: 6b95cc5 |
68193d8 to
f129d4b
Compare
|
Upstream branch: f941479 |
859c8f2 to
60cabeb
Compare
f129d4b to
8d76c66
Compare
|
Upstream branch: f11f7cf |
60cabeb to
f3f1077
Compare
8d76c66 to
eec9a8d
Compare
|
Upstream branch: b28dac3 |
f3f1077 to
11f4537
Compare
eec9a8d to
a003c26
Compare
|
Upstream branch: 78a1605 |
11f4537 to
1c5ad1e
Compare
a003c26 to
48fc95a
Compare
|
Upstream branch: 5e6e1dc |
1c5ad1e to
52acace
Compare
48fc95a to
43c5e2a
Compare
|
Upstream branch: 4af5266 |
52acace to
23abac7
Compare
43c5e2a to
7e4a3f3
Compare
|
Upstream branch: 6e951a9 |
23abac7 to
c0babd2
Compare
7e4a3f3 to
1994f79
Compare
|
Upstream branch: 75cd3be |
The existing code iterates the whole list of bpf ksyms until the right one is found, which means quadratic complexity on top of linked list pointer chasing under rcu. This is't noticeable for most installations, but when one has 10000 bpf programs loaded, things start to add up and reading from `/proc/kallsyms` slows down a lot. Instead of doing that, we can cache the list of bpf symbols in linear time when `/proc/kallsyms` is opened, which makes the whole thing fast. Reading `/proc/kallsyms` on Apple M3 Pro in a VM and measuring system time: Before: * 15 bpf symbols: ~35ms * 10015 bpf symbols: ~1250ms After: * 15 bpf symbols: ~35ms * 10015 bpf symbols: ~50ms Testing in production on v6.12 series (with ~10000 bpf ksyms as well): * On AMD EPYC 9684X (Zen4): ~870ms -> ~100ms * On Ampere Altra Max M128-30: ~4650ms -> ~70ms Signed-off-by: Ivan Babrou <[email protected]>
c0babd2 to
5787af2
Compare
Pull request for series with
subject: kallsyms: cache bpf symbols to avoid quadratic iteration
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1048807