On 3/6/06, David S. Miller <[EMAIL PROTECTED]> wrote:
> From: Benjamin LaHaise <[EMAIL PROTECTED]>
> Date: Mon, 6 Mar 2006 15:06:41 -0800
>
> > This patch removes a couple of memory barriers from atomic bitops that
> > showed up on profiles of netperf.
>
> A little ugly, we should have a nicer way to do this
> generically.

       /* This should be in poll */
-       clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
+       if (test_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags))
+               clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);

Something like fast_clear_bit() that does the above sequence in a inline
function?

Ah, this brings kfree_skb to my mind:

void kfree_skb(struct sk_buff *skb)
{
        if (unlikely(!skb))
                return;
        if (likely(atomic_read(&skb->users) == 1))
                smp_rmb();
        else if (likely(!atomic_dec_and_test(&skb->users)))
                return;
        __kfree_skb(skb);
}

Something similar, no?

fast_atomic_dec_and_test anyone? :-)

- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to