[Devel] [PATCH RHEL9 COMMIT] ve/net/neighbour: restore hashtable size limit
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Apr 26 17:51:34 MSK 2024
The commit is pushed to "branch-rh9-5.14.0-362.18.1.vz9.40.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-362.18.1.vz9.40.5
------>
commit 9ed7d66ec22a3d83eea24246ab75b64c7e48a233
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date: Mon Apr 8 15:29:28 2024 +0300
ve/net/neighbour: restore hashtable size limit
With counters for neigh entries per VE introduced in
https://virtuozzo.atlassian.net/browse/PSBM-87155
tbl->entries, which served as limit of hashtable size,
become unlimited, so the table can grow very large.
Table is allocated via __get_free_pages() which allocates
continious regions of phys mem and large order allocations
are very likely to fail - which was observed in the issue.
To address this limit the allocation order to 5.
Fixes: 019712d0d37d ("ve/net/neighbour: per-ct limit for neighbour entries")
https://virtuozzo.atlassian.net/browse/PSBM-153199
https://pmc.acronis.work/browse/VSTOR-81287
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Feature: net: make the neighbor entries limit per-CT
---
net/core/neighbour.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 9d1302fed0cf..4239afe253ee 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -725,7 +725,13 @@ ___neigh_create(struct neigh_table *tbl, const void *pkey,
nht = rcu_dereference_protected(tbl->nht,
lockdep_is_held(&tbl->lock));
- if (atomic_read(&tbl->entries) > (1 << nht->hash_shift))
+ /*
+ * Since entries can grow unlimited we limit the size of the hash table
+ * here. __get_free_pages allocates continious regions of phys mem
+ * and orders above 10 are very hard to satisfy. We limit the size to 5
+ * as it is the middle ground
+ */
+ if (nht->hash_shift < 5 && atomic_read(&tbl->entries) > (1 << nht->hash_shift))
nht = neigh_hash_grow(tbl, nht->hash_shift + 1);
hash_val = tbl->hash(n->primary_key, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
More information about the Devel
mailing list