* [PATCH net-next] tcp: minor optimization for calculating packets_out in tcp connect
@ 2018-12-15 9:33 Yafang Shao
2018-12-15 12:59 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Yafang Shao @ 2018-12-15 9:33 UTC (permalink / raw)
To: edumazet, davem; +Cc: netdev, linux-kernel, Yafang Shao
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tcp: minor optimization for calculating packets_out in tcp connect
2018-12-15 9:33 [PATCH net-next] tcp: minor optimization for calculating packets_out in tcp connect Yafang Shao
@ 2018-12-15 12:59 ` Eric Dumazet
2018-12-15 19:27 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2018-12-15 12:59 UTC (permalink / raw)
To: Yafang Shao, edumazet, davem; +Cc: netdev, linux-kernel
On 12/15/2018 01:33 AM, Yafang Shao wrote:
> 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.
>
I dunno, I find current code more self-documented.
This is not fast path, so I would suggest we keep it.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tcp: minor optimization for calculating packets_out in tcp connect
2018-12-15 12:59 ` Eric Dumazet
@ 2018-12-15 19:27 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2018-12-15 19:27 UTC (permalink / raw)
To: eric.dumazet; +Cc: laoar.shao, edumazet, netdev, linux-kernel
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 15 Dec 2018 04:59:00 -0800
>
>
> On 12/15/2018 01:33 AM, Yafang Shao wrote:
>> 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.
>>
>
> I dunno, I find current code more self-documented.
>
> This is not fast path, so I would suggest we keep it.
I agree, I won't be applying this.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-15 19:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-15 9:33 [PATCH net-next] tcp: minor optimization for calculating packets_out in tcp connect Yafang Shao
2018-12-15 12:59 ` Eric Dumazet
2018-12-15 19:27 ` 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).