]> www.infradead.org Git - users/jedix/linux-maple.git/commit
inetpeer: avoid false sharing in inet_peer_xrlim_allow()
authorEric Dumazet <edumazet@google.com>
Thu, 19 Dec 2024 15:03:30 +0000 (15:03 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 Dec 2024 21:04:40 +0000 (13:04 -0800)
commit05dd04b218f42c57a14e330fd8583995f141ed6b
tree3ddeeb723012bd6ebc2fd67c8bf1c38a5d0da269
parent710aebdad633d4608568ba8124d643e01866fc6d
inetpeer: avoid false sharing in inet_peer_xrlim_allow()

Under DOS, inet_peer_xrlim_allow() might be called millions
of times per second from different cpus.

Make sure to write over peer->rate_tokens and peer->rate_last
only when really needed.

Note the inherent races of this function are still there,
we do not care of precise ICMP rate limiting.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20241219150330.3159027-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/inetpeer.c