aboutsummaryrefslogtreecommitdiffstats
path: root/net/phonet/socket.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/phonet/socket.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/phonet/socket.c')
-rw-r--r--net/phonet/socket.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index c295c4e20f01..30187990257f 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -340,12 +340,15 @@ static int pn_socket_getname(struct socket *sock, struct sockaddr *addr,
340 return sizeof(struct sockaddr_pn); 340 return sizeof(struct sockaddr_pn);
341} 341}
342 342
343static __poll_t pn_socket_poll_mask(struct socket *sock, __poll_t events) 343static __poll_t pn_socket_poll(struct file *file, struct socket *sock,
344 poll_table *wait)
344{ 345{
345 struct sock *sk = sock->sk; 346 struct sock *sk = sock->sk;
346 struct pep_sock *pn = pep_sk(sk); 347 struct pep_sock *pn = pep_sk(sk);
347 __poll_t mask = 0; 348 __poll_t mask = 0;
348 349
350 poll_wait(file, sk_sleep(sk), wait);
351
349 if (sk->sk_state == TCP_CLOSE) 352 if (sk->sk_state == TCP_CLOSE)
350 return EPOLLERR; 353 return EPOLLERR;
351 if (!skb_queue_empty(&sk->sk_receive_queue)) 354 if (!skb_queue_empty(&sk->sk_receive_queue))
@@ -445,7 +448,7 @@ const struct proto_ops phonet_dgram_ops = {
445 .socketpair = sock_no_socketpair, 448 .socketpair = sock_no_socketpair,
446 .accept = sock_no_accept, 449 .accept = sock_no_accept,
447 .getname = pn_socket_getname, 450 .getname = pn_socket_getname,
448 .poll_mask = datagram_poll_mask, 451 .poll = datagram_poll,
449 .ioctl = pn_socket_ioctl, 452 .ioctl = pn_socket_ioctl,
450 .listen = sock_no_listen, 453 .listen = sock_no_listen,
451 .shutdown = sock_no_shutdown, 454 .shutdown = sock_no_shutdown,
@@ -470,7 +473,7 @@ const struct proto_ops phonet_stream_ops = {
470 .socketpair = sock_no_socketpair, 473 .socketpair = sock_no_socketpair,
471 .accept = pn_socket_accept, 474 .accept = pn_socket_accept,
472 .getname = pn_socket_getname, 475 .getname = pn_socket_getname,
473 .poll_mask = pn_socket_poll_mask, 476 .poll = pn_socket_poll,
474 .ioctl = pn_socket_ioctl, 477 .ioctl = pn_socket_ioctl,
475 .listen = pn_socket_listen, 478 .listen = pn_socket_listen,
476 .shutdown = sock_no_shutdown, 479 .shutdown = sock_no_shutdown,