netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] tcp: Remove check in __tcp_push_pending_frames
@ 2009-12-09  8:26 Krishna Kumar
  2009-12-09  8:26 ` [PATCH 2/3] tcp: Remove unrequired operations in tcp_push() Krishna Kumar
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Krishna Kumar @ 2009-12-09  8:26 UTC (permalink / raw)
  To: davem; +Cc: netdev, Krishna Kumar

From: Krishna Kumar <krkumar2@in.ibm.com>

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 <krkumar2@in.ibm.com>
---
 include/net/tcp.h     |   16 +++++++++-------
 net/ipv4/tcp_output.c |    5 -----
 2 files changed, 9 insertions(+), 12 deletions(-)

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.

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

end of thread, other threads:[~2009-12-23 22:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09  8:26 [PATCH 1/3] tcp: Remove check in __tcp_push_pending_frames Krishna Kumar
2009-12-09  8:26 ` [PATCH 2/3] tcp: Remove unrequired operations in tcp_push() Krishna Kumar
2009-12-10  8:10   ` Ilpo Järvinen
2009-12-10  9:06     ` Krishna Kumar2
2009-12-10 10:26       ` Ilpo Järvinen
2009-12-10 11:59         ` Krishna Kumar2
2009-12-10 12:03           ` Ilpo Järvinen
2009-12-09  8:26 ` [PATCH 3/3] tcp: Slightly optimize tcp_sendmsg Krishna Kumar
2009-12-10  8:17   ` Ilpo Järvinen
2009-12-10 10:29     ` Krishna Kumar2
2009-12-10 10:42       ` Ilpo Järvinen
2009-12-10  8:05 ` [PATCH 1/3] tcp: Remove check in __tcp_push_pending_frames Ilpo Järvinen
2009-12-23 22:15 ` 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).