diff options
| author | Tejun Heo <tj@kernel.org> | 2026-04-20 06:55:07 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-04-20 06:55:07 -1000 |
| commit | ed859d4319863263665b239cd2c62c3aad1664ce (patch) | |
| tree | c57f7bd1e31eab5997fe9b73cc225608511dd6de /include | |
| parent | ce0fb14ea592eb84d6a01b948f2684ddfaac5832 (diff) | |
| parent | 87019cb6c26178cef8fb9f9265b6ab7c4bda5262 (diff) | |
Merge branch 'for-7.1-fixes' into for-7.2
Pull to receive 73bd1227787b ("rhashtable: Restore insecure_elasticity
toggle") as a dependency for upcoming patches that use
.insecure_elasticity = true on their rhashtables.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/rhashtable-types.h | 2 | ||||
| -rw-r--r-- | include/linux/rhashtable.h | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/rhashtable-types.h b/include/linux/rhashtable-types.h index 015c8298bebc..72082428d6c6 100644 --- a/include/linux/rhashtable-types.h +++ b/include/linux/rhashtable-types.h @@ -49,6 +49,7 @@ typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg, * @head_offset: Offset of rhash_head in struct to be hashed * @max_size: Maximum size while expanding * @min_size: Minimum size while shrinking + * @insecure_elasticity: Set to true to disable chain length checks * @automatic_shrinking: Enable automatic shrinking of tables * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash) * @obj_hashfn: Function to hash object @@ -61,6 +62,7 @@ struct rhashtable_params { u16 head_offset; unsigned int max_size; u16 min_size; + bool insecure_elasticity; bool automatic_shrinking; rht_hashfn_t hashfn; rht_obj_hashfn_t obj_hashfn; 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. */ |
