]> git.itanic.dy.fi Git - linux-stable/commit
wireguard: queueing: use saner cpu selection wrapping
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 3 Jul 2023 01:27:04 +0000 (03:27 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Jul 2023 08:17:52 +0000 (09:17 +0100)
commit7387943fa35516f6f8017a3b0e9ce48a3bef9faa
tree20734c41e3773bf0580dbd4fb3adf966a809c76c
parenta27ac5390922059867f645eefd978e533d7af902
wireguard: queueing: use saner cpu selection wrapping

Using `% nr_cpumask_bits` is slow and complicated, and not totally
robust toward dynamic changes to CPU topologies. Rather than storing the
next CPU in the round-robin, just store the last one, and also return
that value. This simplifies the loop drastically into a much more common
pattern.

Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
Cc: stable@vger.kernel.org
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Manuel Leiner <manuel.leiner@gmx.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireguard/queueing.c
drivers/net/wireguard/queueing.h
drivers/net/wireguard/receive.c
drivers/net/wireguard/send.c