bpf: Call maybe_wait_bpf_programs() only once from generic_map_delete_batch()
Subsystems (4)
PATCH 1/1 bpf: Call maybe_wait_bpf_programs() only once from generic_map_delete_batch()
From: Eric Dumazet <[email protected]>
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.
--- kernel/bpf/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/bpf/syscall.c +2 -1
@@ -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; }
Signature · 1 line
2.35.1.473.g83b2b277ed-goog
Quoted 8 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
As stated in the comment found in
maybe_wait_bpf_programs(), thesynchronize_rcu()barrier is only needed before returning to userspace, not after each deletion in the batch.Signed-off-by Eric Dumazet <[email protected]>Cc Stanislav Fomichev <[email protected]>
Makes sense. Probably a copy-paste from the non-batch case...
Quoted 28 lines
Cc Brian Vazquez <[email protected]>--- kernel/bpf/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kernel/bpf/syscall.c +2
-2@@ -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; } --2.35.1.473.g83b2b277ed-goog
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 11 lines · On Fri, 18 Feb 2022 10:18:01 -0800 you wrote:
From: Eric Dumazet <[email protected]>
As stated in the comment found in
maybe_wait_bpf_programs(), thesynchronize_rcu()barrier is only needed before returning to userspace, not after each deletion in the batch.Signed-off-by Eric Dumazet <[email protected]>Cc Stanislav Fomichev <[email protected]>Cc Brian Vazquez <[email protected]>[...]
Here is the summary with links:
- [bpf-next] bpf: Call maybe_wait_bpf_programs() only once from generic_map_delete_batch()
https://git.kernel.org/bpf/bpf-next/c/9087c6ff8dfe
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html