* [PATCH net-next] net: do not read sk_drops if application does not care
@ 2016-12-07 18:05 Eric Dumazet
2016-12-08 18:31 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2016-12-07 18:05 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Paolo Abeni
From: Eric Dumazet <edumazet@google.com>
sk_drops can be an often written field, do not read it unless
application showed interest.
Note that sk_drops can be read via inet_diag, so applications
can avoid getting this info from every received packet.
In the future, 'reading' sk_drops might require folding per node or per
cpu fields, and thus become even more expensive than today.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
---
include/net/sock.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 1749e38d03014558ac882b5d1fb37b11ac5e6705..be167c1483f4a5a74b466f135bbfdf4281e5bef4 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2160,7 +2160,8 @@ struct sock_skb_cb {
static inline void
sock_skb_set_dropcount(const struct sock *sk, struct sk_buff *skb)
{
- SOCK_SKB_CB(skb)->dropcount = atomic_read(&sk->sk_drops);
+ SOCK_SKB_CB(skb)->dropcount = sock_flag(sk, SOCK_RXQ_OVFL) ?
+ atomic_read(&sk->sk_drops) : 0;
}
static inline void sk_drops_add(struct sock *sk, const struct sk_buff *skb)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: do not read sk_drops if application does not care
2016-12-07 18:05 [PATCH net-next] net: do not read sk_drops if application does not care Eric Dumazet
@ 2016-12-08 18:31 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-12-08 18:31 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, pabeni
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 07 Dec 2016 10:05:36 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> sk_drops can be an often written field, do not read it unless
> application showed interest.
>
> Note that sk_drops can be read via inet_diag, so applications
> can avoid getting this info from every received packet.
>
> In the future, 'reading' sk_drops might require folding per node or per
> cpu fields, and thus become even more expensive than today.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-08 18:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 18:05 [PATCH net-next] net: do not read sk_drops if application does not care Eric Dumazet
2016-12-08 18:31 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).