From: Stephen Hemminger <shemminger@linux-foundation.org>
To: netdev@vger.kernel.org
Subject: Re: [PATCH 1/8] [TCP]: Uninline tcp_set_state
Date: Sat, 12 Jan 2008 13:03:55 -0800 [thread overview]
Message-ID: <20080112130355.74c39ae7@deepthought> (raw)
In-Reply-To: <12001308171262-git-send-email-ilpo.jarvinen@helsinki.fi>
On Sat, 12 Jan 2008 11:40:10 +0200
"Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi> wrote:
> net/ipv4/tcp.c:
> tcp_close_state | -226
> tcp_done | -145
> tcp_close | -564
> tcp_disconnect | -141
> 4 functions changed, 1076 bytes removed, diff: -1076
>
> net/ipv4/tcp_input.c:
> tcp_fin | -86
> tcp_rcv_state_process | -164
> 2 functions changed, 250 bytes removed, diff: -250
>
> net/ipv4/tcp_ipv4.c:
> tcp_v4_connect | -209
> 1 function changed, 209 bytes removed, diff: -209
>
> net/ipv4/arp.c:
> arp_ignore | +5
> 1 function changed, 5 bytes added, diff: +5
>
> net/ipv6/tcp_ipv6.c:
> tcp_v6_connect | -158
> 1 function changed, 158 bytes removed, diff: -158
>
> net/sunrpc/xprtsock.c:
> xs_sendpages | -2
> 1 function changed, 2 bytes removed, diff: -2
>
> net/dccp/ccids/ccid3.c:
> ccid3_update_send_interval | +7
> 1 function changed, 7 bytes added, diff: +7
>
> net/ipv4/tcp.c:
> tcp_set_state | +238
> 1 function changed, 238 bytes added, diff: +238
>
> built-in.o:
> 12 functions changed, 250 bytes added, 1695 bytes removed, diff: -1445
>
> I've no explanation why some unrelated changes seem to occur
> consistently as well (arp_ignore, ccid3_update_send_interval;
> I checked the arp_ignore asm and it seems to be due to some
> reordered of operation order causing some extra opcodes to be
> generated). Still, the benefits are pretty obvious from the
> codiff's results.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> Cc: Andi Kleen <andi@firstfloor.org>
> ---
> include/net/tcp.h | 35 +----------------------------------
> net/ipv4/tcp.c | 35 +++++++++++++++++++++++++++++++++++
> 2 files changed, 36 insertions(+), 34 deletions(-)
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 48081ad..306580c 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -926,40 +926,7 @@ static const char *statename[]={
> "Close Wait","Last ACK","Listen","Closing"
> };
> #endif
> -
> -static inline void tcp_set_state(struct sock *sk, int state)
> -{
> - int oldstate = sk->sk_state;
> -
> - switch (state) {
> - case TCP_ESTABLISHED:
> - if (oldstate != TCP_ESTABLISHED)
> - TCP_INC_STATS(TCP_MIB_CURRESTAB);
> - break;
> -
> - case TCP_CLOSE:
> - if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED)
> - TCP_INC_STATS(TCP_MIB_ESTABRESETS);
> -
> - sk->sk_prot->unhash(sk);
> - if (inet_csk(sk)->icsk_bind_hash &&
> - !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
> - inet_put_port(&tcp_hashinfo, sk);
> - /* fall through */
> - default:
> - if (oldstate==TCP_ESTABLISHED)
> - TCP_DEC_STATS(TCP_MIB_CURRESTAB);
> - }
> -
> - /* Change state AFTER socket is unhashed to avoid closed
> - * socket sitting in hash tables.
> - */
> - sk->sk_state = state;
> -
> -#ifdef STATE_TRACE
> - SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]);
> -#endif
> -}
>
Since the function is called with a constant state, I guess the assumption
was that gcc would be smart enough to only include the code needed, it looks like
either code was bigger or the compiler was dumber than expected
--
Stephen Hemminger <stephen.hemminger@vyatta.com>
next prev parent reply other threads:[~2008-01-12 21:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-12 9:40 [PATCH net-2.6.25 0/8] [NET]: More uninlining & related Ilpo Järvinen
2008-01-12 9:40 ` [PATCH 1/8] [TCP]: Uninline tcp_set_state Ilpo Järvinen
2008-01-12 9:40 ` [PATCH 2/8] [TCP]: Uninline tcp_is_cwnd_limited Ilpo Järvinen
2008-01-12 9:40 ` [PATCH 3/8] [XFRM] xfrm_policy: kill some bloat Ilpo Järvinen
2008-01-12 9:40 ` [PATCH 4/8] [IPV6] route: " Ilpo Järvinen
2008-01-12 9:40 ` [PATCH 5/8] [NETLINK] af_netlink: " Ilpo Järvinen
2008-01-12 9:40 ` [PATCH 6/8] [NETFILTER] xt_policy.c: " Ilpo Järvinen
2008-01-12 9:40 ` [PATCH 7/8] [PKTGEN]: Kill dead static inlines Ilpo Järvinen
2008-01-12 9:40 ` [RFC PATCH 8/8] [PKTGEN]: uninline getCurUs Ilpo Järvinen
2008-01-12 12:17 ` Herbert Xu
2008-01-12 12:59 ` Ilpo Järvinen
2008-01-12 21:19 ` Herbert Xu
2008-01-13 4:24 ` David Miller
2008-01-14 7:43 ` Ilpo Järvinen
2008-01-14 7:51 ` David Miller
2008-01-14 8:33 ` Ilpo Järvinen
2008-01-14 8:54 ` David Miller
2008-01-13 4:22 ` David Miller
2008-01-12 21:03 ` Stephen Hemminger [this message]
2008-01-12 21:27 ` [PATCH 1/8] [TCP]: Uninline tcp_set_state Arnaldo Carvalho de Melo
2008-01-14 7:20 ` Ilpo Järvinen
2008-01-17 12:41 ` Andi Kleen
-- strict thread matches above, loose matches on Subject: below --
2008-01-12 9:34 [PATCH net-2.6.25 0/8] [NET]: More uninlining & related Ilpo Järvinen
[not found] ` <12001304691978-git-send-email-ilpo.jarvinen@helsinki.fi>
2008-01-12 11:18 ` [PATCH 1/8] [TCP]: Uninline tcp_set_state David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080112130355.74c39ae7@deepthought \
--to=shemminger@linux-foundation.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.