diff options
author | John Fastabend <john.fastabend@gmail.com> | 2017-09-01 11:29:26 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-01 20:29:32 -0700 |
commit | 90a9631cf8c27a2b4702af600cad390fcabb88fb (patch) | |
tree | 77e77db88a4fccbb79fc44664ba0abe2b8b0faca /drivers/net/hyperv | |
parent | 250b0f78310c11b41b941f6ccd6938b5cf7970cd (diff) | |
download | linux-stable-90a9631cf8c27a2b4702af600cad390fcabb88fb.tar.gz linux-stable-90a9631cf8c27a2b4702af600cad390fcabb88fb.tar.bz2 linux-stable-90a9631cf8c27a2b4702af600cad390fcabb88fb.zip |
bpf: sockmap update/simplify memory accounting scheme
Instead of tracking wmem_queued and sk_mem_charge by incrementing
in the verdict SK_REDIRECT paths and decrementing in the tx work
path use skb_set_owner_w and sock_writeable helpers. This solves
a few issues with the current code. First, in SK_REDIRECT inc on
sk_wmem_queued and sk_mem_charge were being done without the peers
sock lock being held. Under stress this can result in accounting
errors when tx work and/or multiple verdict decisions are working
on the peer psock.
Additionally, this cleans up the code because we can rely on the
default destructor to decrement memory accounting on kfree_skb. Also
this will trigger sk_write_space when space becomes available on
kfree_skb() which wasn't happening before and prevent __sk_free
from being called until all in-flight packets are completed.
Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
0 files changed, 0 insertions, 0 deletions