]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
bpf: lpm_trie memory usage
authorYafang Shao <laoar.shao@gmail.com>
Sun, 5 Mar 2023 12:45:59 +0000 (12:45 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 7 Mar 2023 17:33:42 +0000 (09:33 -0800)
commit41d5941e7f9a27f3d28220f08b843e8d87df1be4
tree4e805c69a2180983bc0c958afaa8376bf5d188f8
parent90a5527d7686d3ebe0dd2a831356a6c7d7dc31bc
bpf: lpm_trie memory usage

trie_mem_usage() is introduced to calculate the lpm_trie memory usage.
Some small memory allocations are ignored. The inner node is also
ignored.

The result as follows,

- before
10: lpm_trie  flags 0x1
        key 8B  value 8B  max_entries 65536  memlock 1048576B

- after
10: lpm_trie  flags 0x1
        key 8B  value 8B  max_entries 65536  memlock 2291536B

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/r/20230305124615.12358-3-laoar.shao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/lpm_trie.c