This patch removes a couple of memory barriers from atomic bitops that 
showed up on profiles of netperf.

                -ben

Signed-off-by: Benjamin LaHaise <[EMAIL PROTECTED]>
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 00aa80e..dadc84c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -682,7 +682,8 @@ int tcp_sendmsg(struct kiocb *iocb, stru
                        goto out_err;
 
        /* 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);
 
        mss_now = tcp_current_mss(sk, !(flags&MSG_OOB));
        size_goal = tp->xmit_size_goal;
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c 
b/net/ipv4/netfilter/ip_conntrack_core.c
index 84c66db..416e310 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -881,7 +881,12 @@ unsigned int ip_conntrack_in(unsigned in
                return -ret;
        }
 
-       if (set_reply && !test_and_set_bit(IPS_SEEN_REPLY_BIT, &ct->status))
+       /* Use test_bit() first as that avoids a memory barrier on implicite
+        * in test_and_set_bit() on some CPUs.  It only gets set once per
+        * connection.
+        */
+       if (set_reply && !test_bit(IPS_SEEN_REPLY_BIT, &ct->status) &&
+           !test_and_set_bit(IPS_SEEN_REPLY_BIT, &ct->status))
                ip_conntrack_event_cache(IPCT_STATUS, *pskb);
 
        return ret;

-
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