From: Benjamin LaHaise <[EMAIL PROTECTED]>
Date: Mon, 6 Mar 2006 15:40:31 -0800

> On Mon, Mar 06, 2006 at 08:29:30PM -0300, Arnaldo Carvalho de Melo wrote:
> > -       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?
> 
> That might make sense.  The general case tends to be better handled by 
> avoiding atomic bitops wherever possible.  In the socket case, a better 
> approach may be to have a set of flags which are protected by the socket 
> lock instead of being atomic bitops.

Wait...

what about "test_and_clear_bit()"?

Most implementations should be doing the light-weight test _first_,
and only do the update if the bit isn't in the state desired.

I think in such cases we can elide the memory barrier.
-
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