[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251009062330.26436-1-chensong_2000@189.cn>
Date: Thu, 9 Oct 2025 14:23:30 +0800
From: chensong_2000@....cn
To: ast@...nel.org,
daniel@...earbox.net,
john.fastabend@...il.com,
andrii@...nel.org,
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
Cc: bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
Song Chen <chensong_2000@....cn>
Subject: [PATCH] kernel/bpf/syscall: use IS_FD_HASH in bpf_map_update_value
From: Song Chen <chensong_2000@....cn>
If IS_FD_HASH is defined on the top of the file, then use it to replace
"map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS".
Signed-off-by: Song Chen <chensong_2000@....cn>
---
kernel/bpf/syscall.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 0fbfa8532c39..2c194a73aeda 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -154,8 +154,7 @@ static void maybe_wait_bpf_programs(struct bpf_map *map)
* time can be very long and userspace may think it will hang forever,
* so don't handle sleepable BPF programs now.
*/
- if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS ||
- map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)
+ if (IS_FD_HASH(map) || map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)
synchronize_rcu();
}
@@ -274,7 +273,7 @@ static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,
} else if (IS_FD_ARRAY(map)) {
err = bpf_fd_array_map_update_elem(map, map_file, key, value,
flags);
- } else if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS) {
+ } else if (IS_FD_HASH(map)) {
err = bpf_fd_htab_map_update_elem(map, map_file, key, value,
flags);
} else if (map->map_type == BPF_MAP_TYPE_REUSEPORT_SOCKARRAY) {
--
2.34.1
Powered by blists - more mailing lists