netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] udp: use sk_protocol instead of pcflag to detect udplite sockets
@ 2017-03-31  9:47 Paolo Abeni
  2017-03-31 13:25 ` Eric Dumazet
  2017-04-02  3:12 ` David Miller
  0 siblings, 2 replies; 8+ messages in thread
From: Paolo Abeni @ 2017-03-31  9:47 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Eric Dumazet

In the udp_sock struct, the 'forward_deficit' and 'pcflag' fields
share the same cacheline. While the first is dirtied by
udp_recvmsg, the latter is read, possibly several times, by the
bottom half processing to discriminate between udp and udplite
sockets.

With this patch, sk->sk_protocol is used to check is the socket is
really an udplite one, avoiding some cache misses per
packet and improving the performance under udp_flood with
small packet up to 10%.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 include/linux/udp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/udp.h b/include/linux/udp.h
index c0f5308..6cb4061 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -115,6 +115,6 @@ static inline bool udp_get_no_check6_rx(struct sock *sk)
 #define udp_portaddr_for_each_entry_rcu(__sk, list) \
 	hlist_for_each_entry_rcu(__sk, list, __sk_common.skc_portaddr_node)
 
-#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag)
+#define IS_UDPLITE(__sk) (__sk->sk_protocol == IPPROTO_UDPLITE)
 
 #endif	/* _LINUX_UDP_H */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-04-02  3:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-31  9:47 [PATCH net-next] udp: use sk_protocol instead of pcflag to detect udplite sockets Paolo Abeni
2017-03-31 13:25 ` Eric Dumazet
2017-03-31 14:33   ` Paolo Abeni
2017-03-31 15:09     ` Eric Dumazet
2017-03-31 15:24       ` Paolo Abeni
2017-03-31 15:03   ` David Laight
2017-03-31 15:24     ` Eric Dumazet
2017-04-02  3:12 ` 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).