diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-05-20 14:36:41 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-04 16:57:59 +0200 |
commit | 03add828b72f2153a5fe7a507b3bc634ca2818fb (patch) | |
tree | 16494a8acd952a62306775f9936cd5bbdb727b60 /src/cookie.h | |
parent | b56d48ce67ebd5222fbc844d05b24a58e320a853 (diff) |
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.
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/cookie.h')
0 files changed, 0 insertions, 0 deletions