bpf: Call maybe_wait_bpf_programs() only once from generic_map_delete_batch()

As stated in the comment found in maybe_wait_bpf_programs(),
the synchronize_rcu() barrier is only needed before returning
to userspace, not after each deletion in the batch.

Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Reviewed-by: Stanislav Fomichev <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
This commit is contained in:
Eric Dumazet authored and Daniel Borkmann committed 2022-02-18 20:37:26 +01:00
1 parent 086d49058c
commit 9087c6ff8d
1 file changed
+2 -1
+2 -1
View File
@@ -1352,7 +1352,6 @@ int generic_map_delete_batch(struct bpf_map *map,
err = map->ops->map_delete_elem(map, key);
rcu_read_unlock();
bpf_enable_instrumentation();
maybe_wait_bpf_programs(map);
if (err)
break;
cond_resched();
@@ -1361,6 +1360,8 @@ int generic_map_delete_batch(struct bpf_map *map,
err = -EFAULT;
kvfree(key);
maybe_wait_bpf_programs(map);
return err;
}