summaryrefslogtreecommitdiffhomepage
path: root/src/peer.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-05-20 14:15:43 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2021-06-04 16:57:59 +0200
commit4d8b7edca7c1cc7894007cd378acb30e870d90f5 (patch)
tree85fe4726e6575634e4fb4adb5208dd425ea9e556 /src/peer.h
parent6fbc0e62842cefac784a817cd70e90d5e29fe816 (diff)
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 <arnd@arndb.de> Suggested-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/peer.h')
-rw-r--r--src/peer.h3
1 files changed, 3 insertions, 0 deletions
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 */