Message ID | 20230322215246.1675516-1-martin.lau@linux.dev (mailing list archive) |
---|---|
Headers | show |
Series | bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage | expand |
Hello: This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <ast@kernel.org>: On Wed, 22 Mar 2023 14:52:41 -0700 you wrote: > 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. > > [...] Here is the summary with links: - [v3,bpf-next,1/5] bpf: Add a few bpf mem allocator functions https://git.kernel.org/bpf/bpf-next/c/e65a5c6edbc6 - [v3,bpf-next,2/5] bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage_elem https://git.kernel.org/bpf/bpf-next/c/08a7ce384e33 - [v3,bpf-next,3/5] bpf: Use bpf_mem_cache_alloc/free for bpf_local_storage https://git.kernel.org/bpf/bpf-next/c/6ae9d5e99e1d - [v3,bpf-next,4/5] selftests/bpf: Test task storage when local_storage->smap is NULL https://git.kernel.org/bpf/bpf-next/c/d8db84d71c0e - [v3,bpf-next,5/5] selftests/bpf: Add bench for task storage creation https://git.kernel.org/bpf/bpf-next/c/cbe9d93d58b1 You are awesome, thank you!
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(-)