From 4d8b7edca7c1cc7894007cd378acb30e870d90f5 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 20 May 2021 14:15:43 +0200 Subject: 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. Suggested-by: Arnd Bergmann Suggested-by: Matthew Wilcox Signed-off-by: Jason A. Donenfeld --- src/peer.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/peer.h') diff --git a/src/peer.h b/src/peer.h index 8d53b68..76e4d31 100644 --- a/src/peer.h +++ b/src/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 */ -- cgit v1.2.3