From: Eric Dumazet Date: Fri, 22 Sep 2023 22:03:55 +0000 (+0000) Subject: tcp_metrics: do not create an entry from tcp_init_metrics() X-Git-Tag: v4.14.330~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80f402e3333d50f90e04fe9cb647c3547c9c7c0d;p=thirdparty%2Fkernel%2Fstable.git tcp_metrics: do not create an entry from tcp_init_metrics() [ Upstream commit a135798e6e200ecb2f864cecca6d257ba278370c ] tcp_init_metrics() only wants to get metrics if they were previously stored in the cache. Creating an entry is adding useless costs, especially when tcp_no_metrics_save is set. Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.") Signed-off-by: Eric Dumazet Reviewed-by: David Ahern Acked-by: Neal Cardwell Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index 164e917d71b21..820a97f92235a 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c @@ -475,7 +475,7 @@ void tcp_init_metrics(struct sock *sk) goto reset; rcu_read_lock(); - tm = tcp_get_metrics(sk, dst, true); + tm = tcp_get_metrics(sk, dst, false); if (!tm) { rcu_read_unlock(); goto reset;