public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sowmini Varadhan <sowmini.varadhan@oracle•com>
To: Eric Dumazet <eric.dumazet@gmail•com>
Cc: santosh shilimkar <santosh.shilimkar@oracle•com>,
	netdev@vger•kernel.org, davem@davemloft•net
Subject: Re: [PATCH v2 net-next] rds-tcp: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket
Date: Tue, 15 Mar 2016 14:16:29 -0400	[thread overview]
Message-ID: <20160315181629.GO11063@oracle.com> (raw)
In-Reply-To: <1458065390.31401.45.camel@edumazet-glaptop3.roam.corp.google.com>

On (03/15/16 11:09), Eric Dumazet wrote:
> 
> You said "just as user-space SO_SNDBUF allows ridiculous values
> for buffer size.."
> 
> So I understood you believe SOCK_MIN_SNDBUF and/or SOCK_MIN_RCVBUF are
> ridiculous ;)

No, no! I was saying that as a clueless user-space app, I can SO_SNDBUF
to 1, and happily think that everything is fine (error == 0), when in
reality the kernel has helpfully fixed up the value for me..

> I pointed to you the actual code.
> 
> sk->sk_sndbuf = max_t(u32, val * 2, SOCK_MIN_SNDBUF);

yes, I'm in the process of changing rds-tcp now (doing sanity tests
etc on it, will send out update in a short while)

> 
> 
> No error is returned. kernel enforces a minimal value.
> 
> #define SOCK_MIN_SNDBUF         (TCP_SKB_MIN_TRUESIZE * 2)
> #define TCP_SKB_MIN_TRUESIZE    (2048 + SKB_DATA_ALIGN(sizeof(struct
> sk_buff)))
> 
> -> 2 * (2048 + 256) = 4608  given current sk_buff overhead (that might
> change in linux 5.4 ... )

Yes, I've seen the comments somewhere (in sock_setsockopt?)

it's a bit unexpectd for someone coming from bsd/solaris because
the value returned by getsockopt is quite unpredictable (as you
point out, depends on the kernel version among other things).

> But again if your sysctl allows to set a value below SOCK_MIN_SNDBUF,
> that might be a problem, because stack could have a hidden bug for very
> small values of sndbuf/rcvbuf. 

sure, fixing/testing it as I write this.

--Sowmini

  reply	other threads:[~2016-03-15 18:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 15:12 [PATCH v2 net-next] rds-tcp: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket Sowmini Varadhan
2016-03-15 16:38 ` santosh shilimkar
2016-03-15 16:58   ` Sowmini Varadhan
2016-03-15 17:18     ` Eric Dumazet
2016-03-15 17:30       ` Sowmini Varadhan
2016-03-15 18:09         ` Eric Dumazet
2016-03-15 18:16           ` Sowmini Varadhan [this message]
2016-03-15 17:30 ` Tom Herbert
2016-03-15 17:34   ` Sowmini Varadhan
2016-03-15 17:47     ` Tom Herbert
2016-03-15 19:57       ` Sowmini Varadhan

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=20160315181629.GO11063@oracle.com \
    --to=sowmini.varadhan@oracle$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=eric.dumazet@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=santosh.shilimkar@oracle$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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