From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] tcp: TCP Small Queues and strange attractors
Date: Tue, 14 Oct 2014 17:16:52 -0400 (EDT) [thread overview]
Message-ID: <20141014.171652.711587177378371980.davem@davemloft.net> (raw)
In-Reply-To: <1413321018.17109.7.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 14 Oct 2014 14:10:18 -0700
> On Tue, 2014-10-14 at 15:33 -0400, David Miller wrote:
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Mon, 13 Oct 2014 06:27:47 -0700
>>
>> > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
>> > index 8d4eac793700..4a7e97811d71 100644
>> > --- a/net/ipv4/tcp_output.c
>> > +++ b/net/ipv4/tcp_output.c
>> > @@ -839,26 +839,38 @@ void tcp_wfree(struct sk_buff *skb)
>> > {
>> ...
>> > local_irq_restore(flags);
>> > - } else {
>> > - sock_wfree(skb);
>> > + return;
>> > }
>> > +out:
>> > + sk_free(sk);
>> > }
>> >
>>
>> Why do we need to release the socket here?
>
> Thats because we had to keep a reference at the very beginning :
>
> + /* Keep one reference on sk_wmem_alloc.
> + * Will be released by sk_free() from here or tcp_tasklet_func()
> + */
> + wmem = atomic_sub_return(skb->truesize - 1, &sk->sk_wmem_alloc);
> +
>
>
> If we find that we do not arm the tasklet (and keep the reference), we
> then can remove the last ref we kept.
>
> sk_free() is essentially doing :
>
> if (atomic_dec_and_test(&sk->sk_wmem_alloc))
> __sk_free(sk)
Gotcha, now it makes sense.
Patch applied, thanks Eric.
prev parent reply other threads:[~2014-10-14 21:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-13 13:27 [PATCH net] tcp: TCP Small Queues and strange attractors Eric Dumazet
2014-10-14 19:33 ` David Miller
2014-10-14 21:10 ` Eric Dumazet
2014-10-14 21:16 ` David Miller [this message]
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=20141014.171652.711587177378371980.davem@davemloft.net \
--to=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