Skip to content

Commit 3417dff

Browse files
ameryhungMartin KaFai Lau
authored andcommitted
bpf: Remove unused percpu counter from bpf_local_storage_map_free
Percpu locks have been removed from cgroup and task local storage. Now that all local storage no longer use percpu variables as locks preventing recursion, there is no need to pass them to bpf_local_storage_map_free(). Remove the argument from the function. Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://patch.msgid.link/20260205222916.1788211-9-ameryhung@gmail.com
1 parent 5254de7 commit 3417dff

6 files changed

Lines changed: 6 additions & 12 deletions

File tree

include/linux/bpf_local_storage.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ bpf_local_storage_lookup(struct bpf_local_storage *local_storage,
166166
void bpf_local_storage_destroy(struct bpf_local_storage *local_storage);
167167

168168
void bpf_local_storage_map_free(struct bpf_map *map,
169-
struct bpf_local_storage_cache *cache,
170-
int __percpu *busy_counter);
169+
struct bpf_local_storage_cache *cache);
171170

172171
int bpf_local_storage_map_check_btf(const struct bpf_map *map,
173172
const struct btf *btf,

kernel/bpf/bpf_cgrp_storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr)
119119

120120
static void cgroup_storage_map_free(struct bpf_map *map)
121121
{
122-
bpf_local_storage_map_free(map, &cgroup_cache, NULL);
122+
bpf_local_storage_map_free(map, &cgroup_cache);
123123
}
124124

125125
/* *gfp_flags* is a hidden argument provided by the verifier */

kernel/bpf/bpf_inode_storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static struct bpf_map *inode_storage_map_alloc(union bpf_attr *attr)
184184

185185
static void inode_storage_map_free(struct bpf_map *map)
186186
{
187-
bpf_local_storage_map_free(map, &inode_cache, NULL);
187+
bpf_local_storage_map_free(map, &inode_cache);
188188
}
189189

190190
const struct bpf_map_ops inode_storage_map_ops = {

kernel/bpf/bpf_local_storage.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,7 @@ bpf_local_storage_map_alloc(union bpf_attr *attr,
807807
}
808808

809809
void bpf_local_storage_map_free(struct bpf_map *map,
810-
struct bpf_local_storage_cache *cache,
811-
int __percpu *busy_counter)
810+
struct bpf_local_storage_cache *cache)
812811
{
813812
struct bpf_local_storage_map_bucket *b;
814813
struct bpf_local_storage_elem *selem;
@@ -841,11 +840,7 @@ void bpf_local_storage_map_free(struct bpf_map *map,
841840
while ((selem = hlist_entry_safe(
842841
rcu_dereference_raw(hlist_first_rcu(&b->list)),
843842
struct bpf_local_storage_elem, map_node))) {
844-
if (busy_counter)
845-
this_cpu_inc(*busy_counter);
846843
bpf_selem_unlink(selem, true);
847-
if (busy_counter)
848-
this_cpu_dec(*busy_counter);
849844
cond_resched_rcu();
850845
}
851846
rcu_read_unlock();

kernel/bpf/bpf_task_storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static struct bpf_map *task_storage_map_alloc(union bpf_attr *attr)
217217

218218
static void task_storage_map_free(struct bpf_map *map)
219219
{
220-
bpf_local_storage_map_free(map, &task_cache, NULL);
220+
bpf_local_storage_map_free(map, &task_cache);
221221
}
222222

223223
BTF_ID_LIST_GLOBAL_SINGLE(bpf_local_storage_map_btf_id, struct, bpf_local_storage_map)

net/core/bpf_sk_storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void bpf_sk_storage_free(struct sock *sk)
6060

6161
static void bpf_sk_storage_map_free(struct bpf_map *map)
6262
{
63-
bpf_local_storage_map_free(map, &sk_cache, NULL);
63+
bpf_local_storage_map_free(map, &sk_cache);
6464
}
6565

6666
static struct bpf_map *bpf_sk_storage_map_alloc(union bpf_attr *attr)

0 commit comments

Comments
 (0)