diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-09-06 07:13:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-06 21:48:45 -0400 |
commit | db40980fcdb560d7992b0511df16cdd3f7e381f3 (patch) | |
tree | 337b5c41bd55915a4b894ea6fe09a865e7dcb0e4 | |
parent | d61702f1273b71c2809365a7806d7fe84fd77f15 (diff) |
net: poll() optimizations
No need to test twice sk->sk_shutdown & RCV_SHUTDOWN
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bluetooth/af_bluetooth.c | 5 | ||||
-rw-r--r-- | net/core/datagram.c | 5 | ||||
-rw-r--r-- | net/sctp/socket.c | 5 | ||||
-rw-r--r-- | net/unix/af_unix.c | 5 |
4 files changed, 8 insertions, 12 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 421c45bd1b95..ed0f22f57668 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -297,13 +297,12 @@ unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *w | |||
297 | mask |= POLLERR; | 297 | mask |= POLLERR; |
298 | 298 | ||
299 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 299 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
300 | mask |= POLLRDHUP; | 300 | mask |= POLLRDHUP | POLLIN | POLLRDNORM; |
301 | 301 | ||
302 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 302 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
303 | mask |= POLLHUP; | 303 | mask |= POLLHUP; |
304 | 304 | ||
305 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 305 | if (!skb_queue_empty(&sk->sk_receive_queue)) |
306 | (sk->sk_shutdown & RCV_SHUTDOWN)) | ||
307 | mask |= POLLIN | POLLRDNORM; | 306 | mask |= POLLIN | POLLRDNORM; |
308 | 307 | ||
309 | if (sk->sk_state == BT_CLOSED) | 308 | if (sk->sk_state == BT_CLOSED) |
diff --git a/net/core/datagram.c b/net/core/datagram.c index 251997a95483..4df1b7a6c1bf 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -746,13 +746,12 @@ unsigned int datagram_poll(struct file *file, struct socket *sock, | |||
746 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 746 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
747 | mask |= POLLERR; | 747 | mask |= POLLERR; |
748 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 748 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
749 | mask |= POLLRDHUP; | 749 | mask |= POLLRDHUP | POLLIN | POLLRDNORM; |
750 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 750 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
751 | mask |= POLLHUP; | 751 | mask |= POLLHUP; |
752 | 752 | ||
753 | /* readable? */ | 753 | /* readable? */ |
754 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 754 | if (!skb_queue_empty(&sk->sk_receive_queue)) |
755 | (sk->sk_shutdown & RCV_SHUTDOWN)) | ||
756 | mask |= POLLIN | POLLRDNORM; | 755 | mask |= POLLIN | POLLRDNORM; |
757 | 756 | ||
758 | /* Connection-based need to check for termination and startup */ | 757 | /* Connection-based need to check for termination and startup */ |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index f4bec2772351..cf6dcc908b88 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -5707,13 +5707,12 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
5707 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 5707 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
5708 | mask |= POLLERR; | 5708 | mask |= POLLERR; |
5709 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 5709 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
5710 | mask |= POLLRDHUP; | 5710 | mask |= POLLRDHUP | POLLIN | POLLRDNORM; |
5711 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 5711 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
5712 | mask |= POLLHUP; | 5712 | mask |= POLLHUP; |
5713 | 5713 | ||
5714 | /* Is it readable? Reconsider this code with TCP-style support. */ | 5714 | /* Is it readable? Reconsider this code with TCP-style support. */ |
5715 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 5715 | if (!skb_queue_empty(&sk->sk_receive_queue)) |
5716 | (sk->sk_shutdown & RCV_SHUTDOWN)) | ||
5717 | mask |= POLLIN | POLLRDNORM; | 5716 | mask |= POLLIN | POLLRDNORM; |
5718 | 5717 | ||
5719 | /* The association is either gone or not ready. */ | 5718 | /* The association is either gone or not ready. */ |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 4414a18c63b4..9077b4ea00c5 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2024,11 +2024,10 @@ static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table | |||
2024 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 2024 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
2025 | mask |= POLLHUP; | 2025 | mask |= POLLHUP; |
2026 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 2026 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
2027 | mask |= POLLRDHUP; | 2027 | mask |= POLLRDHUP | POLLIN | POLLRDNORM; |
2028 | 2028 | ||
2029 | /* readable? */ | 2029 | /* readable? */ |
2030 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 2030 | if (!skb_queue_empty(&sk->sk_receive_queue)) |
2031 | (sk->sk_shutdown & RCV_SHUTDOWN)) | ||
2032 | mask |= POLLIN | POLLRDNORM; | 2031 | mask |= POLLIN | POLLRDNORM; |
2033 | 2032 | ||
2034 | /* Connection-based need to check for termination and startup */ | 2033 | /* Connection-based need to check for termination and startup */ |