From: Tom Herbert <therbert@google.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH net-next 2/2] udp: Reset flow table for flows over unconnected sockets
Date: Mon, 27 Oct 2014 11:01:15 -0700 [thread overview]
Message-ID: <1414432875-23795-2-git-send-email-therbert@google.com> (raw)
In-Reply-To: <1414432875-23795-1-git-send-email-therbert@google.com>
When receiving a packet on an unconnected UDP socket clear the
flow table for the corresponding hash. This is needed so flows over
unconnected UDP sockets will use RPS instead of using what is
present in the flow table. In particular, this avoids having flows
over unconnected sockets be perpetually steered by unrelated
entries in the flow table (idle TCP connections for instance).
Tested:
First filled up the RPS flow tables by creating a bunch of TCP
connections and letting them turn idle. Next, run netperf UDP_RR
with 200 flows.
Before fix:
Client (connected UDP)
81.15% CPU uilization
Server (unneconnedted UDP)
83.63% CPU uilization
118/167/249 90/95/99% latencies
1.59215e+06 tps
After fix:
Client (connected UDP)
81.13% CPU uilization
Server (unneconnedted UDP)
80.68% CPU uilization
116/167/248 90/95/99% latencies
1.61048e+06 tps
Signed-off-by: Tom Herbert <therbert@google.com>
---
net/ipv4/udp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 9a0d346..e58d841 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1451,6 +1451,11 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (inet_sk(sk)->inet_daddr) {
sock_rps_save_rxhash(sk, skb);
sk_mark_napi_id(sk, skb);
+ } else {
+ /* For an unconnected socket reset flow hash so that related
+ * flow will use RPS.
+ */
+ sock_rps_reset_flow_hash(skb->hash);
}
rc = sock_queue_rcv_skb(sk, skb);
--
2.1.0.rc2.206.gedb03e5
next prev parent reply other threads:[~2014-10-27 18:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-27 18:01 [PATCH net-next 1/2] udp: Record RPS flow in socket operations Tom Herbert
2014-10-27 18:01 ` Tom Herbert [this message]
2014-10-27 18:43 ` [PATCH net-next 2/2] udp: Reset flow table for flows over unconnected sockets Eric Dumazet
2014-10-27 19:36 ` Tom Herbert
2014-10-27 23:19 ` Eric Dumazet
2014-10-28 1:09 ` Tom Herbert
2014-10-28 4:51 ` David Miller
2014-10-28 15:18 ` Tom Herbert
2014-10-28 17:38 ` Eric Dumazet
2014-10-28 19:07 ` Tom Herbert
2014-10-28 19:59 ` Eric Dumazet
2014-10-29 1:35 ` Tom Herbert
2014-10-27 18:50 ` [PATCH net-next 1/2] udp: Record RPS flow in socket operations Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414432875-23795-2-git-send-email-therbert@google.com \
--to=therbert@google.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).