From: Martin KaFai Lau <martin.lau@linux.dev>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
kernel-team@meta.com
Subject: [PATCH v3 bpf-next 0/5] bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage
Date: Wed, 22 Mar 2023 14:52:41 -0700 [thread overview]
Message-ID: <20230322215246.1675516-1-martin.lau@linux.dev> (raw)
From: Martin KaFai Lau <martin.lau@kernel.org>
This set is a continuation of the effort in using
bpf_mem_cache_alloc/free in bpf_local_storage [1]
Major change is only using bpf_mem_alloc for task and cgrp storage
while sk and inode stay with kzalloc/kfree. The details is
in patch 2.
[1]: https://lore.kernel.org/bpf/20230308065936.1550103-1-martin.lau@linux.dev/
v3:
- Only use bpf_mem_alloc for task and cgrp storage.
- sk and inode storage stay with kzalloc/kfree.
- Check NULL and add comments in bpf_mem_cache_raw_free() in patch 1.
- Added test and benchmark for task storage.
v2:
- Added bpf_mem_cache_alloc_flags() and bpf_mem_cache_raw_free()
to hide the internal data structure of the bpf allocator.
- Fixed a typo bug in bpf_selem_free()
- Simplified the test_local_storage test by directly using
err returned from libbpf
Martin KaFai Lau (5):
bpf: Add a few bpf mem allocator functions
bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage_elem
bpf: Use bpf_mem_cache_alloc/free for bpf_local_storage
selftests/bpf: Test task storage when local_storage->smap is NULL
selftests/bpf: Add bench for task storage creation
include/linux/bpf_local_storage.h | 7 +-
include/linux/bpf_mem_alloc.h | 2 +
kernel/bpf/bpf_cgrp_storage.c | 2 +-
kernel/bpf/bpf_inode_storage.c | 2 +-
kernel/bpf/bpf_local_storage.c | 223 ++++++++++++++++--
kernel/bpf/bpf_task_storage.c | 2 +-
kernel/bpf/memalloc.c | 59 ++++-
net/core/bpf_sk_storage.c | 2 +-
tools/testing/selftests/bpf/bench.c | 2 +
.../bpf/benchs/bench_local_storage_create.c | 151 ++++++++++--
.../bpf/prog_tests/test_local_storage.c | 7 +-
.../bpf/progs/bench_local_storage_create.c | 25 ++
.../selftests/bpf/progs/local_storage.c | 56 +++--
13 files changed, 472 insertions(+), 68 deletions(-)
--
2.34.1
next reply other threads:[~2023-03-22 21:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 21:52 Martin KaFai Lau [this message]
2023-03-22 21:52 ` [PATCH v3 bpf-next 1/5] bpf: Add a few bpf mem allocator functions Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 2/5] bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage_elem Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 3/5] bpf: Use bpf_mem_cache_alloc/free for bpf_local_storage Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 4/5] selftests/bpf: Test task storage when local_storage->smap is NULL Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 5/5] selftests/bpf: Add bench for task storage creation Martin KaFai Lau
2023-03-28 3:51 ` James Hilliard
2023-03-29 17:02 ` Martin KaFai Lau
2023-03-29 19:12 ` James Hilliard
2023-03-29 19:59 ` Martin KaFai Lau
2023-03-29 20:03 ` James Hilliard
2023-03-29 20:07 ` Martin KaFai Lau
2023-03-30 7:51 ` James Hilliard
2023-03-30 18:12 ` Martin KaFai Lau
2023-03-26 3:12 ` [PATCH v3 bpf-next 0/5] bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230322215246.1675516-1-martin.lau@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).