From patchwork Wed Dec 9 08:26:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Krishna Kumar X-Patchwork-Id: 40712 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 A4404B7B3E for ; Wed, 9 Dec 2009 19:26:37 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751641AbZLII0L (ORCPT ); Wed, 9 Dec 2009 03:26:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751520AbZLII0L (ORCPT ); Wed, 9 Dec 2009 03:26:11 -0500 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:47916 "EHLO e28smtp08.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751506AbZLII0J (ORCPT ); Wed, 9 Dec 2009 03:26:09 -0500 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp08.in.ibm.com (8.14.3/8.13.1) with ESMTP id nB981lrt009912 for ; Wed, 9 Dec 2009 13:31:48 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nB98QEMi2269350 for ; Wed, 9 Dec 2009 13:56:15 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nB98QE8p004200 for ; Wed, 9 Dec 2009 19:26:14 +1100 Received: from localhost.localdomain ([9.77.125.84]) by d28av04.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id nB98QDNW004192; Wed, 9 Dec 2009 19:26:14 +1100 From: Krishna Kumar To: davem@davemloft.net Cc: netdev@vger.kernel.org, Krishna Kumar Date: Wed, 09 Dec 2009 13:56:13 +0530 Message-Id: <20091209082613.19055.58864.sendpatchset@localhost.localdomain> Subject: [PATCH 1/3] tcp: Remove check in __tcp_push_pending_frames Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Krishna Kumar tcp_push checks tcp_send_head and calls __tcp_push_pending_frames, which again checks tcp_send_head, and this unnecessary check is done for every other caller of __tcp_push_pending_frames. Remove tcp_send_head check in __tcp_push_pending_frames and add the check to tcp_push_pending_frames. Other functions call __tcp_push_pending_frames only when tcp_send_head would evaluate to true. Signed-off-by: Krishna Kumar Acked-by: Ilpo Järvinen --- include/net/tcp.h | 16 +++++++++------- net/ipv4/tcp_output.c | 5 ----- 2 files changed, 9 insertions(+), 12 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -ruNp org/include/net/tcp.h new/include/net/tcp.h --- org/include/net/tcp.h 2009-12-04 18:15:26.000000000 +0530 +++ new/include/net/tcp.h 2009-12-09 09:57:39.000000000 +0530 @@ -857,13 +857,6 @@ static inline void tcp_check_probe_timer icsk->icsk_rto, TCP_RTO_MAX); } -static inline void tcp_push_pending_frames(struct sock *sk) -{ - struct tcp_sock *tp = tcp_sk(sk); - - __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle); -} - static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) { tp->snd_wl1 = seq; @@ -1366,6 +1359,15 @@ static inline int tcp_write_queue_empty( return skb_queue_empty(&sk->sk_write_queue); } +static inline void tcp_push_pending_frames(struct sock *sk) +{ + if (tcp_send_head(sk)) { + struct tcp_sock *tp = tcp_sk(sk); + + __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle); + } +} + /* Start sequence of the highest skb with SACKed bit, valid only if * sacked > 0 or when the caller has ensured validity by itself. */ diff -ruNp org/net/ipv4/tcp_output.c new/net/ipv4/tcp_output.c --- org/net/ipv4/tcp_output.c 2009-12-04 18:16:00.000000000 +0530 +++ new/net/ipv4/tcp_output.c 2009-12-04 18:16:24.000000000 +0530 @@ -1799,11 +1799,6 @@ static int tcp_write_xmit(struct sock *s void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, int nonagle) { - struct sk_buff *skb = tcp_send_head(sk); - - if (!skb) - return; - /* If we are closed, the bytes will have to remain here. * In time closedown will finish, we empty the write queue and * all will be happy.