mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ipv6: remove one read_lock()/read_unlock() pair in rt6_check_neigh()
commit c486640aa7 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6e4c40aa27
commit
a4fcf8a242
@@ -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,
|
neigh = __ipv6_neigh_lookup_noref(fib6_nh->fib_nh_dev,
|
||||||
&fib6_nh->fib_nh_gw6);
|
&fib6_nh->fib_nh_gw6);
|
||||||
if (neigh) {
|
if (neigh) {
|
||||||
read_lock(&neigh->lock);
|
u8 nud_state = READ_ONCE(neigh->nud_state);
|
||||||
if (neigh->nud_state & NUD_VALID)
|
|
||||||
|
if (nud_state & NUD_VALID)
|
||||||
ret = RT6_NUD_SUCCEED;
|
ret = RT6_NUD_SUCCEED;
|
||||||
#ifdef CONFIG_IPV6_ROUTER_PREF
|
#ifdef CONFIG_IPV6_ROUTER_PREF
|
||||||
else if (!(neigh->nud_state & NUD_FAILED))
|
else if (!(nud_state & NUD_FAILED))
|
||||||
ret = RT6_NUD_SUCCEED;
|
ret = RT6_NUD_SUCCEED;
|
||||||
else
|
else
|
||||||
ret = RT6_NUD_FAIL_PROBE;
|
ret = RT6_NUD_FAIL_PROBE;
|
||||||
#endif
|
#endif
|
||||||
read_unlock(&neigh->lock);
|
|
||||||
} else {
|
} else {
|
||||||
ret = IS_ENABLED(CONFIG_IPV6_ROUTER_PREF) ?
|
ret = IS_ENABLED(CONFIG_IPV6_ROUTER_PREF) ?
|
||||||
RT6_NUD_SUCCEED : RT6_NUD_FAIL_DO_RR;
|
RT6_NUD_SUCCEED : RT6_NUD_FAIL_DO_RR;
|
||||||
|
|||||||
Reference in New Issue
Block a user