netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] ip: do not set RFS core on error queue reads
@ 2018-01-04  2:47 Soheil Hassas Yeganeh
  2018-01-04  2:47 ` [PATCH net-next 2/2] net: revert "Update RFS target at poll for tcp/udp" Soheil Hassas Yeganeh
  2018-01-05 16:15 ` [PATCH net-next 1/2] ip: do not set RFS core on error queue reads David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Soheil Hassas Yeganeh @ 2018-01-04  2:47 UTC (permalink / raw)
  To: davem, netdev
  Cc: pjt, ycheng, Soheil Hassas Yeganeh, Willem de Bruijn,
	Eric Dumazet, Neal Cardwell

From: Soheil Hassas Yeganeh <soheil@google.com>

We should only record RPS on normal reads and writes.
In single threaded processes, all calls record the same state. In
multi-threaded processes where a separate thread processes
errors, the RFS table mispredicts.

Note that, when CONFIG_RPS is disabled, sock_rps_record_flow
is a noop and no branch is added as a result of this patch.

Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/af_inet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index bab98a4fedad..54cccdd8b1e3 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -790,7 +790,8 @@ int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
 	int addr_len = 0;
 	int err;
 
-	sock_rps_record_flow(sk);
+	if (likely(!(flags & MSG_ERRQUEUE)))
+		sock_rps_record_flow(sk);
 
 	err = sk->sk_prot->recvmsg(sk, msg, size, flags & MSG_DONTWAIT,
 				   flags & ~MSG_DONTWAIT, &addr_len);
-- 
2.16.0.rc0.223.g4a4ac83678-goog

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

end of thread, other threads:[~2018-01-05 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04  2:47 [PATCH net-next 1/2] ip: do not set RFS core on error queue reads Soheil Hassas Yeganeh
2018-01-04  2:47 ` [PATCH net-next 2/2] net: revert "Update RFS target at poll for tcp/udp" Soheil Hassas Yeganeh
2018-01-05 16:15   ` David Miller
2018-01-05 16:15 ` [PATCH net-next 1/2] ip: do not set RFS core on error queue reads 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).