Skip to content

Commit b284986

Browse files
oleg-nesterovbrauner
authored andcommitted
sock_poll_wait: kill the no longer necessary barrier after poll_wait()
Now that poll_wait() provides a full barrier we can remove smp_mb() from sock_poll_wait(). Also, the poll_does_not_wait() check before poll_wait() just adds the unnecessary confusion, kill it. poll_wait() does the same "p && p->_qproc" check. Signed-off-by: Oleg Nesterov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 4e15fa8 commit b284986

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

include/net/sock.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,7 @@ static inline bool skwq_has_sleeper(struct socket_wq *wq)
22912291
}
22922292

22932293
/**
2294-
* sock_poll_wait - place memory barrier behind the poll_wait call.
2294+
* sock_poll_wait - wrapper for the poll_wait call.
22952295
* @filp: file
22962296
* @sock: socket to wait on
22972297
* @p: poll_table
@@ -2301,15 +2301,12 @@ static inline bool skwq_has_sleeper(struct socket_wq *wq)
23012301
static inline void sock_poll_wait(struct file *filp, struct socket *sock,
23022302
poll_table *p)
23032303
{
2304-
if (!poll_does_not_wait(p)) {
2305-
poll_wait(filp, &sock->wq.wait, p);
2306-
/* We need to be sure we are in sync with the
2307-
* socket flags modification.
2308-
*
2309-
* This memory barrier is paired in the wq_has_sleeper.
2310-
*/
2311-
smp_mb();
2312-
}
2304+
/* Provides a barrier we need to be sure we are in sync
2305+
* with the socket flags modification.
2306+
*
2307+
* This memory barrier is paired in the wq_has_sleeper.
2308+
*/
2309+
poll_wait(filp, &sock->wq.wait, p);
23132310
}
23142311

23152312
static inline void skb_set_hash_from_sk(struct sk_buff *skb, struct sock *sk)

0 commit comments

Comments
 (0)