From: Yafang Shao <laoar.shao@gmail.com>
To: edumazet@google.com, davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Yafang Shao <laoar.shao@gmail.com>
Subject: [PATCH net-next] tcp: minor optimization for calculating packets_out in tcp connect
Date: Sat, 15 Dec 2018 17:33:09 +0800 [thread overview]
Message-ID: <1544866389-11168-1-git-send-email-laoar.shao@gmail.com> (raw)
When we building a syn packet, the tcp_skb_pcount(skb) is always 1,
which is set in tcp_init_nondata_skb().
Regarding the syn_data, it is set through
memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)),
which is always 1 as well.
So we don't need to use tcp_skb_pcount(skb), that could give us a
little improvement.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/ipv4/tcp_output.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 730bc44..12bb5e7 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3404,7 +3404,7 @@ static void tcp_connect_queue_skb(struct sock *sk, struct sk_buff *skb)
sk->sk_wmem_queued += skb->truesize;
sk_mem_charge(sk, skb->truesize);
tp->write_seq = tcb->end_seq;
- tp->packets_out += tcp_skb_pcount(skb);
+ tp->packets_out += 1;
}
/* Build and send a SYN with data and (cached) Fast Open cookie. However,
@@ -3486,7 +3486,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
/* data was not sent, put it in write_queue */
__skb_queue_tail(&sk->sk_write_queue, syn_data);
- tp->packets_out -= tcp_skb_pcount(syn_data);
+ tp->packets_out -= 1;
fallback:
/* Send a regular SYN with Fast Open cookie request option */
--
1.8.3.1
next reply other threads:[~2018-12-15 9:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-15 9:33 Yafang Shao [this message]
2018-12-15 12:59 ` [PATCH net-next] tcp: minor optimization for calculating packets_out in tcp connect Eric Dumazet
2018-12-15 19:27 ` 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=1544866389-11168-1-git-send-email-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.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 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).