The patch below replaces a divide by 2 with a shift -- sk_sndbuf is an 
integer, so gcc emits an idiv, which takes 10x longer than a shift by 1.  
This improves af_unix bandwidth by ~6-10K/s.  Also, tidy up the comment 
to fit in 80 columns while we're at it.

                -ben

Signed-off-by: Benjamin LaHaise <[EMAIL PROTECTED]>
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 1b5989b..b57d4d9 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1427,15 +1427,15 @@ static int unix_stream_sendmsg(struct ki
        while(sent < len)
        {
                /*
-                *      Optimisation for the fact that under 0.01% of X 
messages typically
-                *      need breaking up.
+                *      Optimisation for the fact that under 0.01% of X
+                *      messages typically need breaking up.
                 */
 
-               size=len-sent;
+               size = len-sent;
 
                /* Keep two messages in the pipe so it schedules better */
-               if (size > sk->sk_sndbuf / 2 - 64)
-                       size = sk->sk_sndbuf / 2 - 64;
+               if (size > ((sk->sk_sndbuf >> 1) - 64))
+                       size = (sk->sk_sndbuf >> 1) - 64;
 
                if (size > SKB_MAX_ALLOC)
                        size = SKB_MAX_ALLOC;
-
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