diff options
author | Eric Dumazet <edumazet@google.com> | 2020-04-22 09:13:28 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-04-23 12:43:20 -0700 |
commit | 7e417a66b86c110f4b282945dac82e21e0b08328 (patch) | |
tree | b927ae6c6296d1ca3037554c98e6b1d2165455a3 /net/core/dev.c | |
parent | 6f8b12d661d09b488b9ac879b8eafbd2cc4a1450 (diff) | |
download | lwn-7e417a66b86c110f4b282945dac82e21e0b08328.tar.gz lwn-7e417a66b86c110f4b282945dac82e21e0b08328.zip |
net: napi: use READ_ONCE()/WRITE_ONCE()
gro_flush_timeout and napi_defer_hard_irqs can be read
from napi_complete_done() while other cpus write the value,
whithout explicit synchronization.
Use READ_ONCE()/WRITE_ONCE() to annotate the races.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 67585484ad32..afff16849c26 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6242,12 +6242,12 @@ bool napi_complete_done(struct napi_struct *n, int work_done) if (work_done) { if (n->gro_bitmask) - timeout = n->dev->gro_flush_timeout; - n->defer_hard_irqs_count = n->dev->napi_defer_hard_irqs; + timeout = READ_ONCE(n->dev->gro_flush_timeout); + n->defer_hard_irqs_count = READ_ONCE(n->dev->napi_defer_hard_irqs); } if (n->defer_hard_irqs_count > 0) { n->defer_hard_irqs_count--; - timeout = n->dev->gro_flush_timeout; + timeout = READ_ONCE(n->dev->gro_flush_timeout); if (timeout) ret = false; } |