From patchwork Sat Sep 20 21:47:56 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 753 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 8E6E1DDE26 for ; Sun, 21 Sep 2008 07:50:07 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753110AbYITVsw (ORCPT ); Sat, 20 Sep 2008 17:48:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752944AbYITVsw (ORCPT ); Sat, 20 Sep 2008 17:48:52 -0400 Received: from courier.cs.helsinki.fi ([128.214.9.1]:45382 "EHLO mail.cs.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751786AbYITVsH (ORCPT ); Sat, 20 Sep 2008 17:48:07 -0400 Received: from wrl-59.cs.helsinki.fi (wrl-59.cs.helsinki.fi [128.214.166.179]) (AUTH: PLAIN cs-relay, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by mail.cs.helsinki.fi with esmtp; Sun, 21 Sep 2008 00:47:59 +0300 id 0005BEEE.48D56F8F.000053C4 Received: by wrl-59.cs.helsinki.fi (Postfix, from userid 50795) id 0E043A00AB; Sun, 21 Sep 2008 00:47:59 +0300 (EEST) From: "=?ISO-8859-1?Q?Ilpo_J=E4rvinen?=" To: David Miller Cc: netdev@vger.kernel.org, "=?utf-8?q?Ilpo=20J=E4rvinen?=" Subject: [PATCHv2 net-next 13/15] tcp: don't clear retransmit_skb_hint when not necessary Date: Sun, 21 Sep 2008 00:47:56 +0300 Message-Id: <1221947278-16715-14-git-send-email-ilpo.jarvinen@helsinki.fi> X-Mailer: git-send-email 1.5.4.2.156.ge3c5 In-Reply-To: <1221947278-16715-13-git-send-email-ilpo.jarvinen@helsinki.fi> References: <1221947278-16715-1-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-2-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-3-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-4-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-5-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-6-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-7-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-8-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-9-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-10-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-11-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-12-git-send-email-ilpo.jarvinen@helsinki.fi> <1221947278-16715-13-git-send-email-ilpo.jarvinen@helsinki.fi> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Most importantly avoid doing it with cumulative ACK. Not clearing means that we no longer need n^2 processing in resolution of each fast recovery. Signed-off-by: Ilpo Järvinen --- include/net/tcp.h | 7 ++++++- net/ipv4/tcp_input.c | 4 +++- net/ipv4/tcp_output.c | 8 +++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 220f54c..ea81572 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1037,10 +1037,15 @@ static inline void tcp_mib_init(struct net *net) } /* from STCP */ -static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) +static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp) { tp->lost_skb_hint = NULL; tp->scoreboard_skb_hint = NULL; +} + +static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) +{ + tcp_clear_retrans_hints_partial(tp); tp->retransmit_skb_hint = NULL; } diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index d017aed..44a4fff 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2925,7 +2925,9 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets) tcp_unlink_write_queue(skb, sk); sk_wmem_free_skb(sk, skb); - tcp_clear_all_retrans_hints(tp); + tcp_clear_retrans_hints_partial(tp); + if (skb == tp->retransmit_skb_hint) + tp->retransmit_skb_hint = NULL; } if (skb && (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 97873cc..63b9ce1 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -748,7 +748,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, BUG_ON(len > skb->len); - tcp_clear_all_retrans_hints(tp); + tcp_clear_retrans_hints_partial(tp); nsize = skb_headlen(skb) - len; if (nsize < 0) nsize = 0; @@ -1821,7 +1821,9 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, tp->packets_out -= tcp_skb_pcount(next_skb); /* changed transmit queue under us so clear hints */ - tcp_clear_all_retrans_hints(tp); + tcp_clear_retrans_hints_partial(tp); + if (next_skb == tp->retransmit_skb_hint) + tp->retransmit_skb_hint = skb; sk_wmem_free_skb(sk, next_skb); } @@ -1851,7 +1853,7 @@ void tcp_simple_retransmit(struct sock *sk) } } - tcp_clear_all_retrans_hints(tp); + tcp_clear_retrans_hints_partial(tp); if (prior_lost == tp->lost_out) return;