diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-04 17:17:34 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-04 14:25:14 -0700 |
commit | b284d5a787433ec50a222ebcceed6256f4ca3274 (patch) | |
tree | 0dff87ccd3707ab64fbf9f84f94bc2bd5f4c9cf7 /drivers/net/wireguard/peer.h | |
parent | 5a104dcd5da919cb1e6690be5084f61dd2b57c85 (diff) | |
download | wireguard-linux-trimmed-b284d5a787433ec50a222ebcceed6256f4ca3274.tar.gz wireguard-linux-trimmed-b284d5a787433ec50a222ebcceed6256f4ca3274.zip |
wireguard: peer: allocate in kmem_cache
With deployments having upwards of 600k peers now, this somewhat heavy
structure could benefit from more fine-grained allocations.
Specifically, instead of using a 2048-byte slab for a 1544-byte object,
we can now use 1544-byte objects directly, thus saving almost 25%
per-peer, or with 600k peers, that's a savings of 303 MiB. This also
makes wireguard's memory usage more transparent in tools like slabtop
and /proc/slabinfo.
Fixes: b955554b47af ("wireguard: queueing: get rid of per-peer ring buffers")
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>
Diffstat (limited to 'drivers/net/wireguard/peer.h')
-rw-r--r-- | drivers/net/wireguard/peer.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/wireguard/peer.h b/drivers/net/wireguard/peer.h index 8d53b68..76e4d31 100644 --- a/drivers/net/wireguard/peer.h +++ b/drivers/net/wireguard/peer.h @@ -80,4 +80,7 @@ void wg_peer_put(struct wg_peer *peer); void wg_peer_remove(struct wg_peer *peer); void wg_peer_remove_all(struct wg_device *wg); +int wg_peer_init(void); +void wg_peer_uninit(void); + #endif /* _WG_PEER_H */ |