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
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 <firstname.lastname@example.org>
Signed-off-by: Eric Dumazet <email@example.com>
Acked-by: Yuchung Cheng <firstname.lastname@example.org>
Signed-off-by: David S. Miller <email@example.com>
[bwh: Backported to 3.2:
- Drop the Fast Open changes
- Adjust context]
Signed-off-by: Ben Hutchings <firstname.lastname@example.org>
(cherry picked from commit 3e2eb8946907b2d53eb906e13e01d273c6534f5c)
Signed-off-by: Willy Tarreau <email@example.com>
Signed-off-by: Stefan Bader <firstname.lastname@example.org>
1 file changed