aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet/af_packet.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/packet/af_packet.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/packet/af_packet.c')
-rw-r--r--net/packet/af_packet.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index ff8e7e245c37..57634bc3da74 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4076,11 +4076,12 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
4076 return 0; 4076 return 0;
4077} 4077}
4078 4078
4079static __poll_t packet_poll_mask(struct socket *sock, __poll_t events) 4079static __poll_t packet_poll(struct file *file, struct socket *sock,
4080 poll_table *wait)
4080{ 4081{
4081 struct sock *sk = sock->sk; 4082 struct sock *sk = sock->sk;
4082 struct packet_sock *po = pkt_sk(sk); 4083 struct packet_sock *po = pkt_sk(sk);
4083 __poll_t mask = datagram_poll_mask(sock, events); 4084 __poll_t mask = datagram_poll(file, sock, wait);
4084 4085
4085 spin_lock_bh(&sk->sk_receive_queue.lock); 4086 spin_lock_bh(&sk->sk_receive_queue.lock);
4086 if (po->rx_ring.pg_vec) { 4087 if (po->rx_ring.pg_vec) {
@@ -4422,7 +4423,7 @@ static const struct proto_ops packet_ops_spkt = {
4422 .socketpair = sock_no_socketpair, 4423 .socketpair = sock_no_socketpair,
4423 .accept = sock_no_accept, 4424 .accept = sock_no_accept,
4424 .getname = packet_getname_spkt, 4425 .getname = packet_getname_spkt,
4425 .poll_mask = datagram_poll_mask, 4426 .poll = datagram_poll,
4426 .ioctl = packet_ioctl, 4427 .ioctl = packet_ioctl,
4427 .listen = sock_no_listen, 4428 .listen = sock_no_listen,
4428 .shutdown = sock_no_shutdown, 4429 .shutdown = sock_no_shutdown,
@@ -4443,7 +4444,7 @@ static const struct proto_ops packet_ops = {
4443 .socketpair = sock_no_socketpair, 4444 .socketpair = sock_no_socketpair,
4444 .accept = sock_no_accept, 4445 .accept = sock_no_accept,
4445 .getname = packet_getname, 4446 .getname = packet_getname,
4446 .poll_mask = packet_poll_mask, 4447 .poll = packet_poll,
4447 .ioctl = packet_ioctl, 4448 .ioctl = packet_ioctl,
4448 .listen = sock_no_listen, 4449 .listen = sock_no_listen,
4449 .shutdown = sock_no_shutdown, 4450 .shutdown = sock_no_shutdown,