summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorHerbert Xu2015-11-26 06:55:39 +0100
committerDavid S. Miller2015-11-30 20:47:33 +0100
commit1ce0bf50ae2233c7115a18c0c623662d177b434c (patch)
tree41860e17fe4b2184055d29e669e503d09796775a /include/net
parentMerge tag 'wireless-drivers-next-for-davem-2015-11-25' of git://git.kernel.or... (diff)
downloadkernel-qcow2-linux-1ce0bf50ae2233c7115a18c0c623662d177b434c.tar.gz
kernel-qcow2-linux-1ce0bf50ae2233c7115a18c0c623662d177b434c.tar.xz
kernel-qcow2-linux-1ce0bf50ae2233c7115a18c0c623662d177b434c.zip
net: Generalise wq_has_sleeper helper
The memory barrier in the helper wq_has_sleeper is needed by just about every user of waitqueue_active. This patch generalises it by making it take a wait_queue_head_t directly. The existing helper is renamed to skwq_has_sleeper. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/sock.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 7f89e4ba18d1..62d35afcb3ac 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -58,6 +58,7 @@
#include <linux/memcontrol.h>
#include <linux/static_key.h>
#include <linux/sched.h>
+#include <linux/wait.h>
#include <linux/filter.h>
#include <linux/rculist_nulls.h>
@@ -1879,12 +1880,12 @@ static inline bool sk_has_allocations(const struct sock *sk)
}
/**
- * wq_has_sleeper - check if there are any waiting processes
+ * skwq_has_sleeper - check if there are any waiting processes
* @wq: struct socket_wq
*
* Returns true if socket_wq has waiting processes
*
- * The purpose of the wq_has_sleeper and sock_poll_wait is to wrap the memory
+ * The purpose of the skwq_has_sleeper and sock_poll_wait is to wrap the memory
* barrier call. They were added due to the race found within the tcp code.
*
* Consider following tcp code paths:
@@ -1910,15 +1911,9 @@ static inline bool sk_has_allocations(const struct sock *sk)
* data on the socket.
*
*/
-static inline bool wq_has_sleeper(struct socket_wq *wq)
+static inline bool skwq_has_sleeper(struct socket_wq *wq)
{
- /* We need to be sure we are in sync with the
- * add_wait_queue modifications to the wait queue.
- *
- * This memory barrier is paired in the sock_poll_wait.
- */
- smp_mb();
- return wq && waitqueue_active(&wq->wait);
+ return wq && wq_has_sleeper(&wq->wait);
}
/**