From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: dborkman@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH net,v2] net: sock: adapt SOCK_MIN_RCVBUF and SOCK_MIN_SNDBUF
Date: Wed, 19 Jun 2013 21:17:21 -0700 (PDT) [thread overview]
Message-ID: <20130619.211721.1594350084165223337.davem@davemloft.net> (raw)
In-Reply-To: <1371644355.3252.307.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 19 Jun 2013 05:19:15 -0700
> On Wed, 2013-06-19 at 12:51 +0200, Daniel Borkmann wrote:
>> The current situation is that SOCK_MIN_RCVBUF is 2048 + sizeof(struct sk_buff))
>> while SOCK_MIN_SNDBUF is 2048. Since in both cases, skb->truesize is used for
>> sk_{r,w}mem_alloc accounting, we should have both sizes adjusted via defining a
>> TCP_SKB_MIN_TRUESIZE.
>>
>> Further, as Eric Dumazet points out, the minimal skb truesize in transmit path is
>> SKB_TRUESIZE(2048) after commit f07d960df33c5 ("tcp: avoid frag allocation for
>> small frames"), and tcp_sendmsg() tries to limit skb size to half the congestion
>> window, meaning we try to build two skbs at minimum. Thus, having SOCK_MIN_SNDBUF
>> as 2048 can hit a small regression for some applications setting to low
>> SO_SNDBUF / SO_RCVBUF. Note that we define a TCP_SKB_MIN_TRUESIZE, because
>> SKB_TRUESIZE(2048) adds SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), but in
>> case of TCP skbs, the skb_shared_info is part of the 2048 bytes allocation for
>> skb->head.
>>
>> The minor adaption in sk_stream_moderate_sndbuf() is to silence a warning by
>> using a typed max macro, as similarly done in SOCK_MIN_RCVBUF occurences, that
>> would appear otherwise.
>>
>> Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
>> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
>> ---
>> v1 -> v2:
>> - Applied Eric's feedback, fixed up commit message
>> - Set subject to 'net' instead of 'net-next' due to the reported regression
>
> I am fine with this patch (I already run it as a matter of fact), but
> I think its net-next material :
> Regression is not new, and concerns very pathological cases, where
> applications relied on some non documented behavior of network stack.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks guys.
next prev parent reply other threads:[~2013-06-20 4:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 10:51 [PATCH net,v2] net: sock: adapt SOCK_MIN_RCVBUF and SOCK_MIN_SNDBUF Daniel Borkmann
2013-06-19 12:19 ` Eric Dumazet
2013-06-20 4:17 ` David Miller [this message]
2013-07-03 12:02 ` [PATCH] net: sock: fix TCP_SKB_MIN_TRUESIZE Eric Dumazet
2013-07-03 15:31 ` Neal Cardwell
2013-07-03 23:52 ` 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=20130619.211721.1594350084165223337.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/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).