netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Neal Cardwell <ncardwell@google.com>,
	Yuchung Cheng <ycheng@google.com>,
	Soheil Hassas Yeganeh <soheil@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH net-next 1/5] tcp: fix SO_RCVLOWAT and RCVBUF autotuning
Date: Fri, 20 Apr 2018 00:04:44 -0300	[thread overview]
Message-ID: <20180420030443.GD3710@localhost.localdomain> (raw)
In-Reply-To: <CANn89iJXG5zXE155hVK-sZZiVF4Aj55_tSGFP_k683hM=RAwsg@mail.gmail.com>

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.

  reply	other threads:[~2018-04-20  3:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 17:33 [PATCH net-next 0/5] tcp: add zero copy receive Eric Dumazet
2018-04-16 17:33 ` [PATCH net-next 1/5] tcp: fix SO_RCVLOWAT and RCVBUF autotuning Eric Dumazet
2018-04-20  2:02   ` Marcelo Ricardo Leitner
2018-04-20  2:36     ` Eric Dumazet
2018-04-20  3:04       ` Marcelo Ricardo Leitner [this message]
2018-04-16 17:33 ` [PATCH net-next 2/5] tcp: fix delayed acks behavior for SO_RCVLOWAT Eric Dumazet
2018-04-16 17:33 ` [PATCH net-next 3/5] tcp: avoid extra wakeups for SO_RCVLOWAT users Eric Dumazet
2018-04-16 17:33 ` [PATCH net-next 4/5] tcp: implement mmap() for zero copy receive Eric Dumazet
2018-04-19 23:15   ` Eric Dumazet
2018-04-20  1:01     ` Eric Dumazet
2018-04-20  1:17       ` David Miller
2018-04-20 15:19       ` Jonathan Corbet
2018-04-20 15:39         ` Eric Dumazet
2018-04-16 17:33 ` [PATCH net-next 5/5] selftests: net: add tcp_mmap program Eric Dumazet
2018-04-16 22:48 ` [PATCH net-next 0/5] tcp: add zero copy receive David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180420030443.GD3710@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=soheil@google.com \
    --cc=ycheng@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).