aboutsummaryrefslogtreecommitdiffstats
path: root/net/smc
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/smc
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/smc')
-rw-r--r--net/smc/af_smc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index da7f02edcd37..973b4471b532 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1273,7 +1273,8 @@ static __poll_t smc_accept_poll(struct sock *parent)
1273 return mask; 1273 return mask;
1274} 1274}
1275 1275
1276static __poll_t smc_poll_mask(struct socket *sock, __poll_t events) 1276static __poll_t smc_poll(struct file *file, struct socket *sock,
1277 poll_table *wait)
1277{ 1278{
1278 struct sock *sk = sock->sk; 1279 struct sock *sk = sock->sk;
1279 __poll_t mask = 0; 1280 __poll_t mask = 0;
@@ -1289,7 +1290,7 @@ static __poll_t smc_poll_mask(struct socket *sock, __poll_t events)
1289 if ((sk->sk_state == SMC_INIT) || smc->use_fallback) { 1290 if ((sk->sk_state == SMC_INIT) || smc->use_fallback) {
1290 /* delegate to CLC child sock */ 1291 /* delegate to CLC child sock */
1291 release_sock(sk); 1292 release_sock(sk);
1292 mask = smc->clcsock->ops->poll_mask(smc->clcsock, events); 1293 mask = smc->clcsock->ops->poll(file, smc->clcsock, wait);
1293 lock_sock(sk); 1294 lock_sock(sk);
1294 sk->sk_err = smc->clcsock->sk->sk_err; 1295 sk->sk_err = smc->clcsock->sk->sk_err;
1295 if (sk->sk_err) { 1296 if (sk->sk_err) {
@@ -1307,6 +1308,11 @@ static __poll_t smc_poll_mask(struct socket *sock, __poll_t events)
1307 } 1308 }
1308 } 1309 }
1309 } else { 1310 } else {
1311 if (sk->sk_state != SMC_CLOSED) {
1312 release_sock(sk);
1313 sock_poll_wait(file, sk_sleep(sk), wait);
1314 lock_sock(sk);
1315 }
1310 if (sk->sk_err) 1316 if (sk->sk_err)
1311 mask |= EPOLLERR; 1317 mask |= EPOLLERR;
1312 if ((sk->sk_shutdown == SHUTDOWN_MASK) || 1318 if ((sk->sk_shutdown == SHUTDOWN_MASK) ||
@@ -1619,7 +1625,7 @@ static const struct proto_ops smc_sock_ops = {
1619 .socketpair = sock_no_socketpair, 1625 .socketpair = sock_no_socketpair,
1620 .accept = smc_accept, 1626 .accept = smc_accept,
1621 .getname = smc_getname, 1627 .getname = smc_getname,
1622 .poll_mask = smc_poll_mask, 1628 .poll = smc_poll,
1623 .ioctl = smc_ioctl, 1629 .ioctl = smc_ioctl,
1624 .listen = smc_listen, 1630 .listen = smc_listen,
1625 .shutdown = smc_shutdown, 1631 .shutdown = smc_shutdown,