diff options
author | Eric Dumazet <edumazet@google.com> | 2019-10-23 22:44:51 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-10-28 13:33:41 -0700 |
commit | 3f926af3f4d688e2e11e7f8ed04e277a14d4d4a4 (patch) | |
tree | 3cdc7bbab6fc9caa1282afe98eddd91add1aabd7 /net/core | |
parent | 3ef7cf57c72f32f61e97f8fa401bc39ea1f1a5d4 (diff) | |
download | linux-3f926af3f4d688e2e11e7f8ed04e277a14d4d4a4.tar.bz2 |
net: use skb_queue_empty_lockless() in busy poll contexts
Busy polling usually runs without locks.
Let's use skb_queue_empty_lockless() instead of skb_queue_empty()
Also uses READ_ONCE() in __skb_try_recv_datagram() to address
a similar potential problem.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/datagram.c | 2 | ||||
-rw-r--r-- | net/core/sock.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index 5b685e110aff..03515e46a49a 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -278,7 +278,7 @@ struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned int flags, break; sk_busy_loop(sk, flags & MSG_DONTWAIT); - } while (sk->sk_receive_queue.prev != *last); + } while (READ_ONCE(sk->sk_receive_queue.prev) != *last); error = -EAGAIN; diff --git a/net/core/sock.c b/net/core/sock.c index a515392ba84b..b8e758bcb6ad 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3600,7 +3600,7 @@ bool sk_busy_loop_end(void *p, unsigned long start_time) { struct sock *sk = p; - return !skb_queue_empty(&sk->sk_receive_queue) || + return !skb_queue_empty_lockless(&sk->sk_receive_queue) || sk_busy_loop_timeout(sk, start_time); } EXPORT_SYMBOL(sk_busy_loop_end); |