diff options
author | Eric Dumazet <edumazet@google.com> | 2019-10-09 18:10:15 -0400 |
---|---|---|
committer | Jakub Kicinski <jakub.kicinski@netronome.com> | 2019-10-10 00:35:00 -0400 |
commit | 1f142c17d19a5618d5a633195a46f2c8be9bf232 (patch) | |
tree | b64b0a41ac143b7a2eefa20d06eab67a5c4f16da /net | |
parent | 60b173ca3d1cd1782bd0096dc17298ec242f6fb1 (diff) |
tcp: annotate lockless access to tcp_memory_pressure
tcp_memory_pressure is read without holding any lock,
and its value could be changed on other cpus.
Use READ_ONCE() to annotate these lockless reads.
The write side is already using atomic ops.
Fixes: b8da51ebb1aa ("tcp: introduce tcp_under_memory_pressure()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/tcp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f98a1882e537..888c92b63f5a 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -326,7 +326,7 @@ void tcp_enter_memory_pressure(struct sock *sk) | |||
326 | { | 326 | { |
327 | unsigned long val; | 327 | unsigned long val; |
328 | 328 | ||
329 | if (tcp_memory_pressure) | 329 | if (READ_ONCE(tcp_memory_pressure)) |
330 | return; | 330 | return; |
331 | val = jiffies; | 331 | val = jiffies; |
332 | 332 | ||
@@ -341,7 +341,7 @@ void tcp_leave_memory_pressure(struct sock *sk) | |||
341 | { | 341 | { |
342 | unsigned long val; | 342 | unsigned long val; |
343 | 343 | ||
344 | if (!tcp_memory_pressure) | 344 | if (!READ_ONCE(tcp_memory_pressure)) |
345 | return; | 345 | return; |
346 | val = xchg(&tcp_memory_pressure, 0); | 346 | val = xchg(&tcp_memory_pressure, 0); |
347 | if (val) | 347 | if (val) |