BACKPORT: wireguard: allowedips: allocate nodes in kmem_cache
The previous commit moved from O(n) to O(1) for removal, but in the
process introduced an additional pointer member to a struct that
increased the size from 60 to 68 bytes, putting nodes in the 128-byte
slab. With deployed systems having as many as 2 million nodes, this
represents a significant doubling in memory usage (128 MiB -> 256 MiB).
Fix this by using our own kmem_cache, that's sized exactly right. This
also makes wireguard's memory usage more transparent in tools like
slabtop and /proc/slabinfo.
Bug: 254441685
Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
Suggested-by:
Arnd Bergmann <arnd@arndb.de>
Suggested-by:
Matthew Wilcox <willy@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by:
Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by:
David S. Miller <davem@davemloft.net>
(cherry picked from commit dc680de28ca849dfe589dc15ac56d22505f0ef11)
Signed-off-by:
Lee Jones <joneslee@google.com>
Change-Id: Iaf4f3896a7c4b9ee4d410f90d9292aadfc822c2d
Loading
Please register or sign in to comment