summaryrefslogtreecommitdiff
path: root/lib/rhashtable.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-06-02 06:05:42 (GMT)
committerIngo Molnar <mingo@kernel.org>2015-06-02 06:05:42 (GMT)
commitf407a8258610169cd8e975dba7f0b2824562014c (patch)
tree6c87b2d168a4665411a9e16b9f481599f2db25bc /lib/rhashtable.c
parent960d447b94b22ceba286917056871d1dac8da697 (diff)
parentc46a024ea5eb0165114dbbc8c82c29b7bcf66e71 (diff)
downloadlinux-f407a8258610169cd8e975dba7f0b2824562014c.tar.xz
Merge branch 'linus' into sched/core, to resolve conflict
Conflicts: arch/sparc/include/asm/topology_64.h Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r--lib/rhashtable.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index b28df40..4396434 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -14,6 +14,7 @@
* published by the Free Software Foundation.
*/
+#include <linux/atomic.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/log2.h>
@@ -446,6 +447,10 @@ int rhashtable_insert_slow(struct rhashtable *ht, const void *key,
if (key && rhashtable_lookup_fast(ht, key, ht->p))
goto exit;
+ err = -E2BIG;
+ if (unlikely(rht_grow_above_max(ht, tbl)))
+ goto exit;
+
err = -EAGAIN;
if (rhashtable_check_elasticity(ht, tbl, hash) ||
rht_grow_above_100(ht, tbl))
@@ -738,6 +743,12 @@ 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);
/* The maximum (not average) chain length grows with the