Skip to content

Commit 038a3e8

Browse files
Florian Westphaldavem330
authored andcommitted
rhashtable: remove insecure_max_entries param
no users in the tree, insecure_max_entries is always set to ht->p.max_size * 2 in rhtashtable_init(). Replace only spot that uses it with a ht->p.max_size check. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7acedaf commit 038a3e8

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

include/linux/rhashtable.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ struct rhashtable;
125125
* @key_len: Length of key
126126
* @key_offset: Offset of key in struct to be hashed
127127
* @head_offset: Offset of rhash_head in struct to be hashed
128-
* @insecure_max_entries: Maximum number of entries (may be exceeded)
129128
* @max_size: Maximum size while expanding
130129
* @min_size: Minimum size while shrinking
131130
* @nulls_base: Base value to generate nulls marker
@@ -140,7 +139,6 @@ struct rhashtable_params {
140139
size_t key_len;
141140
size_t key_offset;
142141
size_t head_offset;
143-
unsigned int insecure_max_entries;
144142
unsigned int max_size;
145143
unsigned int min_size;
146144
u32 nulls_base;
@@ -329,8 +327,8 @@ static inline bool rht_grow_above_100(const struct rhashtable *ht,
329327
static inline bool rht_grow_above_max(const struct rhashtable *ht,
330328
const struct bucket_table *tbl)
331329
{
332-
return ht->p.insecure_max_entries &&
333-
atomic_read(&ht->nelems) >= ht->p.insecure_max_entries;
330+
return ht->p.max_size &&
331+
(atomic_read(&ht->nelems) / 2u) >= ht->p.max_size;
334332
}
335333

336334
/* The bucket lock is selected based on the hash and protects mutations

lib/rhashtable.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -961,12 +961,6 @@ int rhashtable_init(struct rhashtable *ht,
961961
if (params->max_size)
962962
ht->p.max_size = rounddown_pow_of_two(params->max_size);
963963

964-
if (params->insecure_max_entries)
965-
ht->p.insecure_max_entries =
966-
rounddown_pow_of_two(params->insecure_max_entries);
967-
else
968-
ht->p.insecure_max_entries = ht->p.max_size * 2;
969-
970964
ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE);
971965

972966
if (params->nelem_hint)

0 commit comments

Comments
 (0)