netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>
Subject: Re: [PATCH RFC] net: decrease the length of backlog queue immediately after it's detached from sk
Date: Wed, 30 Mar 2016 13:38:11 +0800	[thread overview]
Message-ID: <56FB6642.4040002@huawei.com> (raw)
In-Reply-To: <1459315520.6473.187.camel@edumazet-glaptop3.roam.corp.google.com>



On 2016/3/30 13:25, Eric Dumazet wrote:
> On Wed, 2016-03-30 at 13:16 +0800, Yang Yingliang wrote:
>> When task A hold the sk owned in tcp_sendmsg, if lots of packets
>> arrive and the packets will be added to backlog queue. The packets
>> will be handled in release_sock called from tcp_sendmsg. When the
>> sk_backlog is removed from sk, the length will not decrease until
>> all the packets in backlog queue are handled. This may leads to the
>> new packets be dropped because the lenth is too big. So set the
>> lenth to 0 immediately after it's detached from sk.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>   net/core/sock.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/net/core/sock.c b/net/core/sock.c
>> index 47fc8bb..108be05 100644
>> --- a/net/core/sock.c
>> +++ b/net/core/sock.c
>> @@ -1933,6 +1933,7 @@ static void __release_sock(struct sock *sk)
>>
>>   	do {
>>   		sk->sk_backlog.head = sk->sk_backlog.tail = NULL;
>> +		sk->sk_backlog.len = 0;
>>   		bh_unlock_sock(sk);
>>
>>   		do {
>
> Certainly not.
>
> Have you really missed the comment ?
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8eae939f1400326b06d0c9afe53d2a484a326871

My kernel is 4.1 LTS, it seems don't have this patch. I will try this 
patch later.

Thanks
Yang
>
>
> I do not believe the case you describe can happen, unless a misbehaving
> driver cooks fat skb (with skb->truesize being far more bigger than
> skb->len)
>
>
>
>
>
>
>

  parent reply	other threads:[~2016-03-30  5:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30  5:16 [PATCH RFC] net: decrease the length of backlog queue immediately after it's detached from sk Yang Yingliang
2016-03-30  5:25 ` Eric Dumazet
2016-03-30  5:34   ` Eric Dumazet
2016-03-30  5:56     ` Yang Yingliang
2016-03-30 13:47       ` Eric Dumazet
2016-04-07  5:59         ` Yang Yingliang
2016-04-07 10:21           ` Eric Dumazet
2016-04-07 14:51             ` Eric Dumazet
2016-04-08 11:18               ` Yang Yingliang
2016-04-08 14:44                 ` Eric Dumazet
2016-04-08 16:53                   ` David Miller
2016-04-08 17:04                     ` Eric Dumazet
2016-04-11 14:42                       ` Yang Yingliang
2016-04-11 11:57                   ` Yang Yingliang
2016-04-11 12:13                     ` Eric Dumazet
2016-04-12  2:59                       ` Yang Yingliang
2016-04-12 12:31                         ` Yang Yingliang
2016-04-13  2:42                           ` Eric Dumazet
2016-03-30  5:38   ` Yang Yingliang [this message]
2016-03-30 12:56 ` Sergei Shtylyov
2016-04-07  6:01   ` Yang Yingliang

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=56FB6642.4040002@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=davem@davemloft.net \
    --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).