aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-28 12:43:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-28 13:40:47 -0400
commita11e1d432b51f63ba698d044441284a661f01144 (patch)
tree9f3c5a10bf0d7f9a342d5fb39c0c35ea14170124 /net/ipv4/udp.c
parentf57494321cbf5b1e7769b6135407d2995a369e28 (diff)
Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL
The poll() changes were not well thought out, and completely unexplained. They also caused a huge performance regression, because "->poll()" was no longer a trivial file operation that just called down to the underlying file operations, but instead did at least two indirect calls. Indirect calls are sadly slow now with the Spectre mitigation, but the performance problem could at least be largely mitigated by changing the "->get_poll_head()" operation to just have a per-file-descriptor pointer to the poll head instead. That gets rid of one of the new indirections. But that doesn't fix the new complexity that is completely unwarranted for the regular case. The (undocumented) reason for the poll() changes was some alleged AIO poll race fixing, but we don't make the common case slower and more complex for some uncommon special case, so this all really needs way more explanations and most likely a fundamental redesign. [ This revert is a revert of about 30 different commits, not reverted individually because that would just be unnecessarily messy - Linus ] Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r--net/ipv4/udp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 9bb27df4dac5..24e116ddae79 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2591,7 +2591,7 @@ int compat_udp_getsockopt(struct sock *sk, int level, int optname,
2591 * udp_poll - wait for a UDP event. 2591 * udp_poll - wait for a UDP event.
2592 * @file - file struct 2592 * @file - file struct
2593 * @sock - socket 2593 * @sock - socket
2594 * @events - events to wait for 2594 * @wait - poll table
2595 * 2595 *
2596 * This is same as datagram poll, except for the special case of 2596 * This is same as datagram poll, except for the special case of
2597 * blocking sockets. If application is using a blocking fd 2597 * blocking sockets. If application is using a blocking fd
@@ -2600,23 +2600,23 @@ int compat_udp_getsockopt(struct sock *sk, int level, int optname,
2600 * but then block when reading it. Add special case code 2600 * but then block when reading it. Add special case code
2601 * to work around these arguably broken applications. 2601 * to work around these arguably broken applications.
2602 */ 2602 */
2603__poll_t udp_poll_mask(struct socket *sock, __poll_t events) 2603__poll_t udp_poll(struct file *file, struct socket *sock, poll_table *wait)
2604{ 2604{
2605 __poll_t mask = datagram_poll_mask(sock, events); 2605 __poll_t mask = datagram_poll(file, sock, wait);
2606 struct sock *sk = sock->sk; 2606 struct sock *sk = sock->sk;
2607 2607
2608 if (!skb_queue_empty(&udp_sk(sk)->reader_queue)) 2608 if (!skb_queue_empty(&udp_sk(sk)->reader_queue))
2609 mask |= EPOLLIN | EPOLLRDNORM; 2609 mask |= EPOLLIN | EPOLLRDNORM;
2610 2610
2611 /* Check for false positives due to checksum errors */ 2611 /* Check for false positives due to checksum errors */
2612 if ((mask & EPOLLRDNORM) && !(sock->file->f_flags & O_NONBLOCK) && 2612 if ((mask & EPOLLRDNORM) && !(file->f_flags & O_NONBLOCK) &&
2613 !(sk->sk_shutdown & RCV_SHUTDOWN) && first_packet_length(sk) == -1) 2613 !(sk->sk_shutdown & RCV_SHUTDOWN) && first_packet_length(sk) == -1)
2614 mask &= ~(EPOLLIN | EPOLLRDNORM); 2614 mask &= ~(EPOLLIN | EPOLLRDNORM);
2615 2615
2616 return mask; 2616 return mask;
2617 2617
2618} 2618}
2619EXPORT_SYMBOL(udp_poll_mask); 2619EXPORT_SYMBOL(udp_poll);
2620 2620
2621int udp_abort(struct sock *sk, int err) 2621int udp_abort(struct sock *sk, int err)
2622{ 2622{