]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tcp: make connect() mem charging friendly
authorEric Dumazet <edumazet@google.com>
Tue, 18 Nov 2014 07:06:20 +0000 (23:06 -0800)
committerJiri Slaby <jslaby@suse.cz>
Thu, 9 Apr 2015 11:13:48 +0000 (13:13 +0200)
commitd06381e8aac5271952076d66b001a01f5613599a
treea9c89b9264c0fef6c81ebc762bc9f918ae1bd976
parentee1887e4934d87202f7c15e3baef2b8ea2f34d8f
tcp: make connect() mem charging friendly

[ Upstream commit 355a901e6cf1b2b763ec85caa2a9f04fbcc4ab4a ]

While working on sk_forward_alloc problems reported by Denys
Fedoryshchenko, we found that tcp connect() (and fastopen) do not call
sk_wmem_schedule() for SYN packet (and/or SYN/DATA packet), so
sk_forward_alloc is negative while connect is in progress.

We can fix this by calling regular sk_stream_alloc_skb() both for the
SYN packet (in tcp_connect()) and the syn_data packet in
tcp_send_syn_data()

Then, tcp_send_syn_data() can avoid copying syn_data as we simply
can manipulate syn_data->cb[] to remove SYN flag (and increment seq)

Instead of open coding memcpy_fromiovecend(), simply use this helper.

This leaves in socket write queue clean fast clone skbs.

This was tested against our fastopen packetdrill tests.

Reported-by: Denys Fedoryshchenko <nuclearcat@nuclearcat.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
net/ipv4/tcp_output.c