Skip to content

Commit 37ba5b5

Browse files
Hou TaoAlexei Starovoitov
authored andcommitted
bpf: Call maybe_wait_bpf_programs() only once for generic_map_update_batch()
Just like commit 9087c6f ("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: Hou Tao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent c26f2a8 commit 37ba5b5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kernel/bpf/syscall.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,
203203
rcu_read_unlock();
204204
}
205205
bpf_enable_instrumentation();
206-
maybe_wait_bpf_programs(map);
207206

208207
return err;
209208
}
@@ -1577,6 +1576,7 @@ static int map_update_elem(union bpf_attr *attr, bpfptr_t uattr)
15771576
}
15781577

15791578
err = bpf_map_update_value(map, f.file, key, value, attr->flags);
1579+
maybe_wait_bpf_programs(map);
15801580

15811581
kvfree(value);
15821582
free_key:
@@ -1816,6 +1816,8 @@ int generic_map_update_batch(struct bpf_map *map, struct file *map_file,
18161816

18171817
kvfree(value);
18181818
kvfree(key);
1819+
1820+
maybe_wait_bpf_programs(map);
18191821
return err;
18201822
}
18211823

0 commit comments

Comments
 (0)