diff options
author | Paolo Abeni <pabeni@redhat.com> | 2020-02-28 16:45:22 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-28 23:12:53 +0300 |
commit | e427cad6eee47e2daf207cd7a4156ae72496ee07 (patch) | |
tree | 9d8b2dd6c404c843212078fb52a8f38b75214afc /net/unix/af_unix.c | |
parent | 7782040b950b5d0433f734fb2bba8b8b5ed6ce5a (diff) | |
download | linux-e427cad6eee47e2daf207cd7a4156ae72496ee07.tar.xz |
net: datagram: drop 'destructor' argument from several helpers
The only users for such argument are the UDP protocol and the UNIX
socket family. We can safely reclaim the accounted memory directly
from the UDP code and, after the previous patch, we can do scm
stats accounting outside the datagram helpers.
Overall this cleans up a bit some datagram-related helpers, and
avoids an indirect call per packet in the UDP receive path.
v1 -> v2:
- call scm_stat_del() only when not peeking - Kirill
- fix build issue with CONFIG_INET_ESPINTCP
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index c46fa271fc4a..3385a7a0b231 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2106,9 +2106,12 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, skip = sk_peek_offset(sk, flags); skb = __skb_try_recv_datagram(sk, &sk->sk_receive_queue, flags, - scm_stat_del, &skip, &err, &last); - if (skb) + &skip, &err, &last); + if (skb) { + if (!(flags & MSG_PEEK)) + scm_stat_del(sk, skb); break; + } mutex_unlock(&u->iolock); |