diff options
author | Eric Dumazet <edumazet@google.com> | 2023-03-13 23:17:32 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-10 23:00:46 +0300 |
commit | a4fcf8a242c6c89002aa9a406a83d370833f4a58 (patch) | |
tree | 39a9ea0a6bfb203d77d2eb72da9145e7bebda68b | |
parent | 6e4c40aa270b72673473a3e0e8a8dc36284ad1f8 (diff) | |
download | linux-a4fcf8a242c6c89002aa9a406a83d370833f4a58.tar.xz |
ipv6: remove one read_lock()/read_unlock() pair in rt6_check_neigh()
commit c486640aa710ddd06c13a7f7162126e1552e8842 upstream.
rt6_check_neigh() uses read_lock() to protect n->nud_state reading.
This seems overkill and causes false sharing.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/ipv6/route.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 0a9f854bfa50..0bcdb675ba2c 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -690,16 +690,16 @@ static enum rt6_nud_state rt6_check_neigh(const struct fib6_nh *fib6_nh) neigh = __ipv6_neigh_lookup_noref(fib6_nh->fib_nh_dev, &fib6_nh->fib_nh_gw6); if (neigh) { - read_lock(&neigh->lock); - if (neigh->nud_state & NUD_VALID) + u8 nud_state = READ_ONCE(neigh->nud_state); + + if (nud_state & NUD_VALID) ret = RT6_NUD_SUCCEED; #ifdef CONFIG_IPV6_ROUTER_PREF - else if (!(neigh->nud_state & NUD_FAILED)) + else if (!(nud_state & NUD_FAILED)) ret = RT6_NUD_SUCCEED; else ret = RT6_NUD_FAIL_PROBE; #endif - read_unlock(&neigh->lock); } else { ret = IS_ENABLED(CONFIG_IPV6_ROUTER_PREF) ? RT6_NUD_SUCCEED : RT6_NUD_FAIL_DO_RR; |