net: annotate lockless accesses to sk->sk_pacing_shift
sk->sk_pacing_shift can be read and written without lock synchronization. This patch adds annotations to document this fact and avoid future syzbot complains. This might also avoid unexpected false sharing in sk_pacing_shift_update(), as the compiler could remove the conditional check and always write over sk->sk_pacing_shift : if (sk->sk_pacing_shift != val) sk->sk_pacing_shift = val; Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
cad46039e4
commit
7c68fa2bdd
@@ -2588,9 +2588,9 @@ static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto)
|
||||
*/
|
||||
static inline void sk_pacing_shift_update(struct sock *sk, int val)
|
||||
{
|
||||
if (!sk || !sk_fullsock(sk) || sk->sk_pacing_shift == val)
|
||||
if (!sk || !sk_fullsock(sk) || READ_ONCE(sk->sk_pacing_shift) == val)
|
||||
return;
|
||||
sk->sk_pacing_shift = val;
|
||||
WRITE_ONCE(sk->sk_pacing_shift, val);
|
||||
}
|
||||
|
||||
/* if a socket is bound to a device, check that the given device
|
||||
|
Reference in New Issue
Block a user