From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Ricardo Leitner Subject: Re: [PATCH net-next 1/5] tcp: fix SO_RCVLOWAT and RCVBUF autotuning Date: Fri, 20 Apr 2018 00:04:44 -0300 Message-ID: <20180420030443.GD3710@localhost.localdomain> References: <20180416173339.6310-1-edumazet@google.com> <20180416173339.6310-2-edumazet@google.com> <20180420020221.GC3710@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Miller , netdev , Neal Cardwell , Yuchung Cheng , Soheil Hassas Yeganeh , Eric Dumazet To: Eric Dumazet Return-path: Received: from mail-qk0-f173.google.com ([209.85.220.173]:41930 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754100AbeDTDEv (ORCPT ); Thu, 19 Apr 2018 23:04:51 -0400 Received: by mail-qk0-f173.google.com with SMTP id s78so7547812qkl.8 for ; Thu, 19 Apr 2018 20:04:51 -0700 (PDT) Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Apr 20, 2018 at 02:36:52AM +0000, Eric Dumazet wrote: > On Thu, Apr 19, 2018 at 7:02 PM Marcelo Ricardo Leitner < > marcelo.leitner@gmail.com> wrote: > > > Hi Eric, > > > As val may be changed to a smaller value by the line above, shouldn't > > it assign sk->sk_rcvlowat again? Otherwise it may still be bigger > > than sk_rcvbuf. > > > Say val = 512k, sysctl_tcp_rmem[2] = 256k > > val <<= 1 , val = 1M > > val = min() , val = 256k > > val > sk_rcvbuf > > sk_rcvbuf = 256k , at most, which is smaller than sk_rcvlowat > > > Without reassigning the application has to check how big is > > tcp_rmem[2] and be sure to not go above /2 of it to not trip on this > > again. > > I am not sure about that : > > Reporting an error might break existing applications that were not > expecting setsockopt() > to return an error, even if the value was 'probably too big to be okay' I would argue that they are already broken but... > > > > Or, as you have added a return value here, it could return -EINVAL in > > such cases. Probably better, as then the application will not get a > > smaller buffer than wanted later. > > Note that maybe some applications might first set SO_RCVLOWAT, then > SO_RCVBUF, > we do not want to break them. ... yeah.. if they do it this way, they work today. Good point. > > > My patch really covers the case were autotuning should immediately grow the > sk_rcvbuf > for reasonable SO_RCVLOWAT values. That's not exactly what the comment above the function says, thus why my comments. Thanks.