-
Notifications
You must be signed in to change notification settings - Fork 159
kallsyms: cache bpf symbols to avoid quadratic iteration #10892
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
base: bpf-next_base
Are you sure you want to change the base?
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 |
69bc599 to
fdb5a97
Compare
cecc6f5 to
68193d8
Compare
|
Upstream branch: d95d76a |
fdb5a97 to
859c8f2
Compare
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
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]>
|
Upstream branch: b28dac3 |
f3f1077 to
11f4537
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