bpf, sockmap: Remove skb_set_owner_w wmem will be taken later from sendpage
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 9 Oct 2020 18:36:57 +0000 (11:36 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 12 Oct 2020 01:00:57 +0000 (18:00 -0700)
commit29545f4977cf7c7b721aa4d43418632af1d6836d
tree78f809b45a88d4ef94447b33a9e0be2495e99ed3
parent9ecbfb06a078c4911fb444203e8e41d93d22f886
bpf, sockmap: Remove skb_set_owner_w wmem will be taken later from sendpage

The skb_set_owner_w is unnecessary here. The sendpage call will create a
fresh skb and set the owner correctly from workqueue. Its also not entirely
harmless because it consumes cycles, but also impacts resource accounting
by increasing sk_wmem_alloc. This is charging the socket we are going to
send to for the skb, but we will put it on the workqueue for some time
before this happens so we are artifically inflating sk_wmem_alloc for
this period. Further, we don't know how many skbs will be used to send the
packet or how it will be broken up when sent over the new socket so
charging it with one big sum is also not correct when the workqueue may
break it up if facing memory pressure. Seeing we don't know how/when
this is going to be sent drop the early accounting.

A later patch will do proper accounting charged on receive socket for
the case where skbs get enqueued on the workqueue.

Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/160226861708.5692.17964237936462425136.stgit@john-Precision-5820-Tower
net/core/skmsg.c