diff options
author | Benjamin LaHaise <benjamin.c.lahaise@intel.com> | 2006-03-21 00:29:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 00:29:05 -0500 |
commit | e9df7d7f584666533b1bdfcf5c60a43d64689198 (patch) | |
tree | 78faaa085edfb24784e40779864d41fd9ddeb168 /net | |
parent | 231d06ae826664b83369166449144304859a62fa (diff) |
[AF_UNIX]: use shift instead of integer division
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.
Signed-off-by: Benjamin LaHaise <benjamin.c.lahaise@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/unix/af_unix.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index c323cc6a28b0..2b00460f2886 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1427,15 +1427,15 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1427 | while(sent < len) | 1427 | while(sent < len) |
1428 | { | 1428 | { |
1429 | /* | 1429 | /* |
1430 | * Optimisation for the fact that under 0.01% of X messages typically | 1430 | * Optimisation for the fact that under 0.01% of X |
1431 | * need breaking up. | 1431 | * messages typically need breaking up. |
1432 | */ | 1432 | */ |
1433 | 1433 | ||
1434 | size=len-sent; | 1434 | size = len-sent; |
1435 | 1435 | ||
1436 | /* Keep two messages in the pipe so it schedules better */ | 1436 | /* Keep two messages in the pipe so it schedules better */ |
1437 | if (size > sk->sk_sndbuf / 2 - 64) | 1437 | if (size > ((sk->sk_sndbuf >> 1) - 64)) |
1438 | size = sk->sk_sndbuf / 2 - 64; | 1438 | size = (sk->sk_sndbuf >> 1) - 64; |
1439 | 1439 | ||
1440 | if (size > SKB_MAX_ALLOC) | 1440 | if (size > SKB_MAX_ALLOC) |
1441 | size = SKB_MAX_ALLOC; | 1441 | size = SKB_MAX_ALLOC; |