[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B1AD0CD.4040407@gmail.com>
Date: Sat, 05 Dec 2009 22:29:49 +0100
From: Jarek Poplawski <jarkao2@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
CC: "David S. Miller" <davem@...emloft.net>,
Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: [PATCH] inetpeer: optimizations
Eric Dumazet wrote, On 12/05/2009 01:11 PM:
> - Use atomic_dec_and_test() in inet_putpeer()
atomic_dec_and_lock()?
> This takes/dirties the lock only if necessary.
...
> void inet_putpeer(struct inet_peer *p)
> {
> - spin_lock_bh(&inet_peer_unused_lock);
> - if (atomic_dec_and_test(&p->refcnt)) {
> - list_add_tail(&p->unused, &unused_peers);
> + local_bh_disable();
> + if (atomic_dec_and_lock(&p->refcnt, &unused_peers.lock)) {
Why not:
if (atomic_dec_and_test(&p->refcnt)) {
spin_lock_bh(&inet_peer_unused_lock);
...
Jarek P.
--
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