diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-07-03 04:05:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-03 04:05:41 -0400 |
commit | 40b215e594b65a3488576c9d24b367548e18902a (patch) | |
tree | 251b8247f97494b7461acc431044e81c33470254 /net/ipv4/tcp_output.c | |
parent | b4653e99450693b75a3c6c8ff4f070164f12815e (diff) |
tcp: de-bloat a bit with factoring NET_INC_STATS_BH out
There are some places in TCP that select one MIB index to
bump snmp statistics like this:
if (<something>)
NET_INC_STATS_BH(<some_id>);
else if (<something_else>)
NET_INC_STATS_BH(<some_other_id>);
...
else
NET_INC_STATS_BH(<default_id>);
or in a more tricky but still similar way.
On the other hand, this NET_INC_STATS_BH is a camouflaged
increment of percpu variable, which is not that small.
Factoring those cases out de-bloats 235 bytes on non-preemptible
i386 config and drives parts of the code into 80 columns.
add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-235 (-235)
function old new delta
tcp_fastretrans_alert 1437 1424 -13
tcp_dsack_set 137 124 -13
tcp_xmit_retransmit_queue 690 676 -14
tcp_try_undo_recovery 283 265 -18
tcp_sacktag_write_queue 1550 1515 -35
tcp_update_reordering 162 106 -56
tcp_retransmit_timer 990 904 -86
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 8f83ab432705..edef2afe905e 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1985,14 +1985,17 @@ void tcp_xmit_retransmit_queue(struct sock *sk) | |||
1985 | 1985 | ||
1986 | if (sacked & TCPCB_LOST) { | 1986 | if (sacked & TCPCB_LOST) { |
1987 | if (!(sacked & (TCPCB_SACKED_ACKED|TCPCB_SACKED_RETRANS))) { | 1987 | if (!(sacked & (TCPCB_SACKED_ACKED|TCPCB_SACKED_RETRANS))) { |
1988 | int mib_idx; | ||
1989 | |||
1988 | if (tcp_retransmit_skb(sk, skb)) { | 1990 | if (tcp_retransmit_skb(sk, skb)) { |
1989 | tp->retransmit_skb_hint = NULL; | 1991 | tp->retransmit_skb_hint = NULL; |
1990 | return; | 1992 | return; |
1991 | } | 1993 | } |
1992 | if (icsk->icsk_ca_state != TCP_CA_Loss) | 1994 | if (icsk->icsk_ca_state != TCP_CA_Loss) |
1993 | NET_INC_STATS_BH(LINUX_MIB_TCPFASTRETRANS); | 1995 | mib_idx = LINUX_MIB_TCPFASTRETRANS; |
1994 | else | 1996 | else |
1995 | NET_INC_STATS_BH(LINUX_MIB_TCPSLOWSTARTRETRANS); | 1997 | mib_idx = LINUX_MIB_TCPSLOWSTARTRETRANS; |
1998 | NET_INC_STATS_BH(mib_idx); | ||
1996 | 1999 | ||
1997 | if (skb == tcp_write_queue_head(sk)) | 2000 | if (skb == tcp_write_queue_head(sk)) |
1998 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | 2001 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, |