diff options
author | Yafang Shao <laoar.shao@gmail.com> | 2023-03-05 13:46:11 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-03-07 18:33:43 +0100 |
commit | 7490b7f1c02ef825ef98f7230662049d4a464a21 (patch) | |
tree | b94f3d6e0f8a61e29a91a517dfd050f3df9ae6d9 /net | |
parent | bpf: local_storage memory usage (diff) | |
download | linux-7490b7f1c02ef825ef98f7230662049d4a464a21.tar.xz linux-7490b7f1c02ef825ef98f7230662049d4a464a21.zip |
bpf, net: bpf_local_storage memory usage
A new helper is introduced into bpf_local_storage map to calculate the
memory usage. This helper is also used by other maps like
bpf_cgrp_storage, bpf_inode_storage, bpf_task_storage and etc.
Note that currently the dynamically allocated storage elements are not
counted in the usage, since it will take extra runtime overhead in the
elements update or delete path. So let's put it aside now, and implement
it in the future when someone really need it.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/r/20230305124615.12358-15-laoar.shao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/bpf_sk_storage.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index bb378c33f542..7a36353dbc22 100644 --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -324,6 +324,7 @@ const struct bpf_map_ops sk_storage_map_ops = { .map_local_storage_charge = bpf_sk_storage_charge, .map_local_storage_uncharge = bpf_sk_storage_uncharge, .map_owner_storage_ptr = bpf_sk_storage_ptr, + .map_mem_usage = bpf_local_storage_map_mem_usage, }; const struct bpf_func_proto bpf_sk_storage_get_proto = { |