All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] rhashtable: remove insecure_max_entries param
@ 2017-04-25  9:41 Florian Westphal
  2017-04-25 11:04 ` Herbert Xu
  2017-04-26 18:39 ` [PATCH net-next] rhashtable: remove insecure_max_entries param David Miller
  0 siblings, 2 replies; 24+ messages in thread
From: Florian Westphal @ 2017-04-25  9:41 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal

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 <fw@strlen.de>
---
 include/linux/rhashtable.h | 6 ++----
 lib/rhashtable.c           | 6 ------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index ae87dcdf52d2..ae93b65d13d7 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -125,7 +125,6 @@ struct rhashtable;
  * @key_len: Length of key
  * @key_offset: Offset of key in struct to be hashed
  * @head_offset: Offset of rhash_head in struct to be hashed
- * @insecure_max_entries: Maximum number of entries (may be exceeded)
  * @max_size: Maximum size while expanding
  * @min_size: Minimum size while shrinking
  * @nulls_base: Base value to generate nulls marker
@@ -140,7 +139,6 @@ struct rhashtable_params {
 	size_t			key_len;
 	size_t			key_offset;
 	size_t			head_offset;
-	unsigned int		insecure_max_entries;
 	unsigned int		max_size;
 	unsigned int		min_size;
 	u32			nulls_base;
@@ -329,8 +327,8 @@ static inline bool rht_grow_above_100(const struct rhashtable *ht,
 static inline bool rht_grow_above_max(const struct rhashtable *ht,
 				      const struct bucket_table *tbl)
 {
-	return ht->p.insecure_max_entries &&
-	       atomic_read(&ht->nelems) >= ht->p.insecure_max_entries;
+	return ht->p.max_size &&
+	       (atomic_read(&ht->nelems) / 2u) >= ht->p.max_size;
 }
 
 /* The bucket lock is selected based on the hash and protects mutations
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index d22a5ef109fb..f3b82e0d417b 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -961,12 +961,6 @@ int rhashtable_init(struct rhashtable *ht,
 	if (params->max_size)
 		ht->p.max_size = rounddown_pow_of_two(params->max_size);
 
-	if (params->insecure_max_entries)
-		ht->p.insecure_max_entries =
-			rounddown_pow_of_two(params->insecure_max_entries);
-	else
-		ht->p.insecure_max_entries = ht->p.max_size * 2;
-
 	ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE);
 
 	if (params->nelem_hint)
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2017-04-28 15:42 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-25  9:41 [PATCH net-next] rhashtable: remove insecure_max_entries param Florian Westphal
2017-04-25 11:04 ` Herbert Xu
2017-04-25 11:23   ` Florian Westphal
2017-04-25 13:28     ` Herbert Xu
2017-04-25 14:17       ` Florian Westphal
2017-04-25 14:48         ` David Miller
2017-04-27  5:44           ` rhashtable - Cap total number of entries to 2^31 Herbert Xu
2017-04-27 10:11             ` Florian Westphal
2017-04-27 10:13               ` Herbert Xu
2017-04-27 15:48             ` David Miller
2017-04-27 21:16             ` Florian Fainelli
2017-04-27 22:21               ` Florian Fainelli
2017-04-27 22:28                 ` [PATCH net-next] rhashtable: Make sure max_size is non zero Florian Fainelli
2017-04-27 22:32                   ` Florian Fainelli
2017-04-27 22:30                 ` Florian Fainelli
2017-04-28  6:10                   ` [PATCH net-next] rhashtable: Do not lower max_elems when max_size is zero Herbert Xu
2017-04-28 14:14                     ` David Miller
2017-04-28 15:42                       ` Florian Fainelli
2017-04-28 10:23                 ` rhashtable - Cap total number of entries to 2^31 Christian Borntraeger
2017-04-28 11:31                   ` Herbert Xu
2017-04-28 11:43                     ` Christian Borntraeger
2017-04-28  2:10             ` [lkp-robot] [rhashtable ] df7008bdd5: Kernel_panic-not_syncing:rtnetlink_init:cannot_initialize_rtnetlink kernel test robot
2017-04-28  2:10               ` kernel test robot
2017-04-26 18:39 ` [PATCH net-next] rhashtable: remove insecure_max_entries param David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.