Commit 37ba5b59 authored by Hou Tao's avatar Hou Tao Committed by Alexei Starovoitov

bpf: Call maybe_wait_bpf_programs() only once for generic_map_update_batch()

Just like commit 9087c6ff ("bpf: Call maybe_wait_bpf_programs() only
once from generic_map_delete_batch()"), there is also no need to call
maybe_wait_bpf_programs() for each update in batched update, so only
call it once in generic_map_update_batch().
Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20231208102355.2628918-3-houtao@huaweicloud.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent c26f2a89
...@@ -203,7 +203,6 @@ static int bpf_map_update_value(struct bpf_map *map, struct file *map_file, ...@@ -203,7 +203,6 @@ static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,
rcu_read_unlock(); rcu_read_unlock();
} }
bpf_enable_instrumentation(); bpf_enable_instrumentation();
maybe_wait_bpf_programs(map);
return err; return err;
} }
...@@ -1577,6 +1576,7 @@ static int map_update_elem(union bpf_attr *attr, bpfptr_t uattr) ...@@ -1577,6 +1576,7 @@ static int map_update_elem(union bpf_attr *attr, bpfptr_t uattr)
} }
err = bpf_map_update_value(map, f.file, key, value, attr->flags); err = bpf_map_update_value(map, f.file, key, value, attr->flags);
maybe_wait_bpf_programs(map);
kvfree(value); kvfree(value);
free_key: free_key:
...@@ -1816,6 +1816,8 @@ int generic_map_update_batch(struct bpf_map *map, struct file *map_file, ...@@ -1816,6 +1816,8 @@ int generic_map_update_batch(struct bpf_map *map, struct file *map_file,
kvfree(value); kvfree(value);
kvfree(key); kvfree(key);
maybe_wait_bpf_programs(map);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment