[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090610.011743.230851451.davem@davemloft.net>
Date: Wed, 10 Jun 2009 01:17:43 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: rusty@...tcorp.com.au, netdev@...r.kernel.org
Subject: Re: [PATCH] net: No more expensive sock_hold()/sock_put() on each
tx
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Thu, 04 Jun 2009 11:18:35 +0200
> @@ -1172,12 +1186,18 @@ void __init sk_init(void)
> void sock_wfree(struct sk_buff *skb)
> {
> struct sock *sk = skb->sk;
> + int res;
>
> /* In case it might be waiting for more memory. */
> - atomic_sub(skb->truesize, &sk->sk_wmem_alloc);
> + res = atomic_sub_return(skb->truesize, &sk->sk_wmem_alloc);
> if (!sock_flag(sk, SOCK_USE_WRITE_QUEUE))
> sk->sk_write_space(sk);
> - sock_put(sk);
> + /*
> + * if sk_wmem_alloc reached 0, we are last user and should
> + * free this sock, as sk_free() call could not do it.
> + */
> + if (res == 0)
> + __sk_free(sk);
> }
> EXPORT_SYMBOL(sock_wfree);
>
Eric, I don't understand this part, please enlighten me :-)
Just because we've liberated all of the write buffer space, that does
not mean that it's time to kill off the socket completely.
Right?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists