-
Notifications
You must be signed in to change notification settings - Fork 680
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btf: don't copy types during CO-RE relocation
During CO-RE relocation we need to ignore qualifiers and Typedefs. So far we've done this by creating a full copy of each target type with those types stripped out.It turns out that this is really expensive especially for large types like struct sk_buff. Stop copying types during CO-RE relocation and instead use the existing UnderlyingType() and a new helper as() to skip when appropriate. As a rule of thumb, anytime we do a type assertion during CO-RE relocation we should use one of these helpers as appropriate. Embarrassingly this leads to a speedup of 99.99% for large types: goos: linux goarch: amd64 pkg: github.com/cilium/ebpf/btf cpu: 12th Gen Intel(R) Core(TM) i7-1260P │ base.txt │ opt.txt │ │ sec/op │ sec/op vs base │ CORESkBuff/byte_off-16 2987010.0n ± 2% 311.9n ± 1% -99.99% (p=0.002 n=6) CORESkBuff/byte_sz-16 3016966.0n ± 0% 348.2n ± 1% -99.99% (p=0.002 n=6) CORESkBuff/field_exists-16 3036697.5n ± 2% 320.9n ± 2% -99.99% (p=0.002 n=6) CORESkBuff/signed-16 3133408.5n ± 3% 211.9n ± 1% -99.99% (p=0.002 n=6) CORESkBuff/lshift_u64-16 3129531.5n ± 5% 358.9n ± 4% -99.99% (p=0.002 n=6) CORESkBuff/rshift_u64-16 3131090.5n ± 6% 346.9n ± 1% -99.99% (p=0.002 n=6) CORESkBuff/local_type_id-16 23.83n ± 2% 23.12n ± 2% -2.98% (p=0.002 n=6) CORESkBuff/target_type_id-16 3660381.0n ± 48% 266.7n ± 4% -99.99% (p=0.002 n=6) CORESkBuff/type_exists-16 6158062.0n ± 18% 256.6n ± 6% -100.00% (p=0.002 n=6) CORESkBuff/type_size-16 4724512.0n ± 6% 282.9n ± 1% -99.99% (p=0.002 n=6) CORESkBuff/enumval_exists-16 703.0n ± 7% 271.2n ± 12% -61.42% (p=0.002 n=6) CORESkBuff/enumval_value-16 749.0n ± 9% 335.8n ± 18% -55.16% (p=0.002 n=6) geomean 319.3µ 240.5n -99.92% Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
- Loading branch information
Showing
3 changed files
with
79 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters