[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20016bd97ab4aa47c4c49f9e46bf6ac0b4c4a124.1744169424.git.dxu@dxuuu.xyz>
Date: Tue, 8 Apr 2025 21:33:58 -0600
From: Daniel Xu <dxu@...uu.xyz>
To: andrii@...nel.org,
ast@...nel.org,
daniel@...earbox.net
Cc: john.fastabend@...il.com,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC bpf-next 03/13] bpf: Move percpu memory allocator definition into core
The BPF percpu memory allocator is used from multiple places. So move it
into the core and have verifier.c simply consume it.
Signed-off-by: Daniel Xu <dxu@...uu.xyz>
---
include/linux/bpf.h | 2 +-
kernel/bpf/core.c | 6 ++++++
kernel/bpf/verifier.c | 3 ---
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index f1c5356dc099..8e26141f3e7e 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -64,7 +64,7 @@ extern struct idr btf_idr;
extern spinlock_t btf_idr_lock;
extern struct kobject *btf_kobj;
extern struct bpf_mem_alloc bpf_global_ma, bpf_global_percpu_ma;
-extern bool bpf_global_ma_set;
+extern bool bpf_global_ma_set, bpf_global_percpu_ma_set;
typedef u64 (*bpf_callback_t)(u64, u64, u64, u64, u64);
typedef int (*bpf_iter_init_seq_priv_t)(void *private_data,
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index ba6b6118cf50..80ba83cb6350 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -68,6 +68,12 @@
struct bpf_mem_alloc bpf_global_ma;
bool bpf_global_ma_set;
+struct bpf_mem_alloc bpf_global_percpu_ma;
+EXPORT_SYMBOL_GPL(bpf_global_percpu_ma);
+
+bool bpf_global_percpu_ma_set;
+EXPORT_SYMBOL_GPL(bpf_global_percpu_ma_set);
+
/* No hurry in this branch
*
* Exported for the bpf jit load helper.
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 6ed302dab08b..322c1674b626 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -44,9 +44,6 @@ static const struct bpf_verifier_ops * const bpf_verifier_ops[] = {
#undef BPF_LINK_TYPE
};
-struct bpf_mem_alloc bpf_global_percpu_ma;
-static bool bpf_global_percpu_ma_set;
-
/* bpf_check() is a static code analyzer that walks eBPF program
* instruction by instruction and updates register/stack state.
* All paths of conditional branches are analyzed until 'bpf_exit' insn.
--
2.47.1
Powered by blists - more mailing lists