summaryrefslogtreecommitdiff
path: root/include/linux/rhashtable.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2026-04-18 09:41:21 +0800
committerTejun Heo <tj@kernel.org>2026-04-19 05:47:21 -1000
commit73bd1227787bfe73eea3d04c63a89cb55db9c23e (patch)
tree1e1c5196573a1e1cb3cab5e4fd5fc2e1c34b498f /include/linux/rhashtable.h
parent3cd8b194bf3428dfa53120fee47e827a7c495815 (diff)
downloadlwn-73bd1227787bfe73eea3d04c63a89cb55db9c23e.tar.gz
lwn-73bd1227787bfe73eea3d04c63a89cb55db9c23e.zip
rhashtable: Restore insecure_elasticity toggle
Some users of rhashtable cannot handle insertion failures, and are happy to accept the consequences of a hash table that having very long chains. Restore the insecure_elasticity toggle for these users. In addition to disabling the chain length checks, this also removes the emergency resize that would otherwise occur when the hash table occupancy hits 100% (an async resize is still scheduled at 75%). Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/rhashtable.h')
-rw-r--r--include/linux/rhashtable.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 0480509a6339..7def3f0f556b 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -821,14 +821,15 @@ slow_path:
goto out;
}
- if (elasticity <= 0)
+ if (elasticity <= 0 && !params.insecure_elasticity)
goto slow_path;
data = ERR_PTR(-E2BIG);
if (unlikely(rht_grow_above_max(ht, tbl)))
goto out_unlock;
- if (unlikely(rht_grow_above_100(ht, tbl)))
+ if (unlikely(rht_grow_above_100(ht, tbl)) &&
+ !params.insecure_elasticity)
goto slow_path;
/* Inserting at head of list makes unlocking free. */