[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221105025146.238209-1-horenchuang@bytedance.com>
Date: Sat, 5 Nov 2022 02:51:42 +0000
From: "Ho-Ren (Jack) Chuang" <horenchuang@...edance.com>
To: Alexei Starovoitov <ast@...nel.org>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Jiri Olsa <olsajiri@...il.com>,
Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Quentin Monnet <quentin@...valent.com>,
Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>,
Joanne Koong <joannelkoong@...il.com>,
Kui-Feng Lee <kuifeng@...com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Maxim Mikityanskiy <maximmi@...dia.com>,
Hao Xiang <hao.xiang@...edance.com>,
Punit Agrawal <punit.agrawal@...edance.com>,
Yifei Ma <yifeima@...edance.com>,
Xiaoning Ding <xiaoning.ding@...edance.com>,
bpf@...r.kernel.org
Cc: Ho-Ren Chuang <horenc@...edu>,
Ho-Ren Chuang <horenchuang@...edance.com>,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [PATCH bpf-next v1 0/4] Add BPF htab map's used size for monitoring
Hello everyone,
We have prepared patches to address an issue from a previous discussion.
The previous discussion email thread is here: https://lore.kernel.org/all/CAADnVQLBt0snxv4bKwg1WKQ9wDFbaDCtZ03v1-LjOTYtsKPckQ@mail.gmail.com/
This patch series adds a new field "used_entries" to struct bpf_map_info
and keeps tracking the "count" field in bpf_htab in both the preallocated
and non-preallocated cases.
bpftool is modified to report the newly added "used_entries" field in
struct bpf_map_info and to mark pre-allocated htab maps with "*".
These make it easier to view the current memory situation of a hashmap.
We have added a new interface function map_get_used_elem in bpf_map_ops
to provide an abstraction layer so that other map type implementations can
support the "used_entries" attribute in a future change.
A concurrency testing for pre-allocated and dynamically allocated
htab maps is introduced to test the correctness and performance of
htab map's used size.
Existing unit tests are integrated to test the correctness of
htab map's used size.
Thank you,
Ho-Ren (Jack) Chuang (4):
bpf: Support reporting BPF htab map's used size for monitoring
bpftool: Add tools support to show BPF htab map's used size
samples/bpf: Add concurrency testing for BPF htab map's used size
selftests/bpf: Add unit tests for BPF htab map's used size
include/linux/bpf.h | 1 +
include/uapi/linux/bpf.h | 1 +
kernel/bpf/hashtab.c | 19 +++
kernel/bpf/syscall.c | 2 +
samples/bpf/Makefile | 4 +
samples/bpf/test_map_used_kern.c | 65 ++++++++
samples/bpf/test_map_used_user.c | 204 ++++++++++++++++++++++++
tools/bpf/bpftool/map.c | 9 +-
tools/include/uapi/linux/bpf.h | 1 +
tools/testing/selftests/bpf/test_maps.c | 74 ++++++++-
10 files changed, 377 insertions(+), 3 deletions(-)
create mode 100644 samples/bpf/test_map_used_kern.c
create mode 100644 samples/bpf/test_map_used_user.c
--
Ho-Ren (Jack) Chuang
Powered by blists - more mailing lists