From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net-next V2 1/1] tcp: Prevent needless syn-ack rexmt during TWHS Date: Sat, 27 Oct 2012 10:50:23 +0200 Message-ID: <1351327823.30380.132.camel@edumazet-glaptop> References: <1351238750-13611-1-git-send-email-subramanian.vijay@gmail.com> <1351287724.30380.35.camel@edumazet-glaptop> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Julian Anastasov , netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, ncardwell@google.com, Venkat Venkatsubra , Elliott Hughes To: Vijay Subramanian Return-path: Received: from mail-ea0-f174.google.com ([209.85.215.174]:54824 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756296Ab2J0Iu1 (ORCPT ); Sat, 27 Oct 2012 04:50:27 -0400 Received: by mail-ea0-f174.google.com with SMTP id c13so1105149eaa.19 for ; Sat, 27 Oct 2012 01:50:26 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Fri, 2012-10-26 at 17:07 -0700, Vijay Subramanian wrote: > > Thanks for the feedback. I will wait for suggestions as to what to do > with the patch and have another look at the code. It seems to me current code for defer accept should be fixed as well. 'Allowing' to send the last SYNACK hoping this wont be lost somewhere seems really strange. syn_ack_recalc(...) { ... /* * Do not resend while waiting for data after ACK, * start to resend on end of deferring period to give * last chance for data or ACK to create established socket. */ *resend = !inet_rsk(req)->acked || req->num_timeout >= rskq_defer_accept - 1; } DEFER_ACCEPT should really mean : We have the socket, only defer putting it in the accept queue until : - Client sent data. Or - A given amount of time has elapsed Defer accept is typically used by protocols where client sends the first chunk of data. If after XX seconds chunk of data is still not there, sending a SYNACK wont really help : just pass the fd to application and application probably will wait another XX seconds for the client request, then timeout and close the socket. So instead of sending a final SYNACK just to be able to receive an ACK and finally put the request into listener accept queue is a waste of bandwidth. We should put the request into listener accept queue and save one/two messages.