summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJulian Anastasov <ja@ssi.bg>2026-03-04 00:04:07 +0300
committerFlorian Westphal <fw@strlen.de>2026-03-04 13:45:45 +0300
commit2fa7cc9c70254d42a82bf82827d8d20cafe975d2 (patch)
tree07f14eb227175bc7dd9cf7377a7a166c7abe277e /include/linux
parent840aac3d900d09ec8fb8efe41bd7d09f9eb15538 (diff)
downloadlinux-2fa7cc9c70254d42a82bf82827d8d20cafe975d2.tar.xz
ipvs: switch to per-net connection table
Use per-net resizable hash table for connections. The global table is slow to walk when using many namespaces. The table can be resized in the range of [256 - ip_vs_conn_tab_size]. Table is attached only while services are present. Resizing is done by delayed work based on load (the number of connections). Add a hash_key field into the connection to store the table ID in the highest bit and the entry's hash value in the lowest bits. The lowest part of the hash value is used as bucket ID, the remaining part is used to filter the entries in the bucket before matching the keys and as result, helps the lookup operation to access only one cache line. By knowing the table ID and bucket ID for entry, we can unlink it without calculating the hash value and doing lookup by keys. We need only to validate the saved hash_key under lock. For better security switch from jhash to siphash for the default connection hashing but the persistence engines may use their own function. Keeping the hash table loaded with entries below the size (12%) allows to avoid collision for 96+% of the conns. ip_vs_conn_fill_cport() now will rehash the connection with proper locking because unhash+hash is not safe for RCU readers. To invalidate the templates setting just dport to 0xffff is enough, no need to rehash them. As result, ip_vs_conn_unhash() is now unused and removed. Signed-off-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions