diff options
author | Hou Tao <houtao1@huawei.com> | 2023-10-20 16:31:57 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-10-21 00:15:06 +0300 |
commit | b460bc8302f222d346f0c15bba980eb8c36d6278 (patch) | |
tree | 73bd8effe56c8dcae3d9bfd166ff6772d5abb604 /include | |
parent | 394e6869f0185e89cb815db29bf819474df858ae (diff) | |
download | linux-b460bc8302f222d346f0c15bba980eb8c36d6278.tar.xz |
mm/percpu.c: introduce pcpu_alloc_size()
Introduce pcpu_alloc_size() to get the size of the dynamic per-cpu
area. It will be used by bpf memory allocator in the following patches.
BPF memory allocator maintains per-cpu area caches for multiple area
sizes and its free API only has the to-be-freed per-cpu pointer, so it
needs the size of dynamic per-cpu area to select the corresponding cache
when bpf program frees the dynamic per-cpu pointer.
Acked-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20231020133202.4043247-3-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/percpu.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 68fac2e7cbe6..8c677f185901 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -132,6 +132,7 @@ extern void __init setup_per_cpu_areas(void); extern void __percpu *__alloc_percpu_gfp(size_t size, size_t align, gfp_t gfp) __alloc_size(1); extern void __percpu *__alloc_percpu(size_t size, size_t align) __alloc_size(1); extern void free_percpu(void __percpu *__pdata); +extern size_t pcpu_alloc_size(void __percpu *__pdata); DEFINE_FREE(free_percpu, void __percpu *, free_percpu(_T)) |