diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-05-20 14:15:43 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-04 16:57:59 +0200 |
commit | 4d8b7edca7c1cc7894007cd378acb30e870d90f5 (patch) | |
tree | 85fe4726e6575634e4fb4adb5208dd425ea9e556 /src/peer.h | |
parent | 6fbc0e62842cefac784a817cd70e90d5e29fe816 (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.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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 */ |