* [PATCH v3 0/2] nft hash resize fixes
@ 2015-02-24 17:25 Josh Hunt
2015-02-24 17:25 ` [PATCH v3 1/2] rhashtable: require max_shift if grow_decision defined Josh Hunt
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Josh Hunt @ 2015-02-24 17:25 UTC (permalink / raw)
To: Pablo Neira Ayuso, Patrick McHardy, Thomas Graf
Cc: netfilter-devel, netdev, Daniel Borkmann, Josh Hunt
v3:
* Renames NFT_HASH_MAX_ELEMENTS to NFT_HASH_MAX_BUCKETS
* Add Acked-by for Thomas
Josh Hunt (2):
rhashtable: require max_shift if grow_decision defined
nft_hash: define max_shift rhashtable parameter
lib/rhashtable.c | 3 ++-
net/netfilter/nft_hash.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] rhashtable: require max_shift if grow_decision defined
2015-02-24 17:25 [PATCH v3 0/2] nft hash resize fixes Josh Hunt
@ 2015-02-24 17:25 ` Josh Hunt
2015-02-24 17:25 ` [PATCH v3 2/2] nft_hash: define max_shift rhashtable parameter Josh Hunt
2015-02-24 17:35 ` [PATCH v3 0/2] nft hash resize fixes Nicolas Dichtel
2 siblings, 0 replies; 5+ messages in thread
From: Josh Hunt @ 2015-02-24 17:25 UTC (permalink / raw)
To: Pablo Neira Ayuso, Patrick McHardy, Thomas Graf
Cc: netfilter-devel, netdev, Daniel Borkmann, Josh Hunt
If an rhashtable user defines a grow_decision fn they must also define a
max_shift parameter.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Josh Hunt <johunt@akamai.com>
---
lib/rhashtable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 9cc4c4a..7d6f539 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -1077,7 +1077,8 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
size = HASH_DEFAULT_SIZE;
if ((params->key_len && !params->hashfn) ||
- (!params->key_len && !params->obj_hashfn))
+ (!params->key_len && !params->obj_hashfn) ||
+ (params->grow_decision && !params->max_shift))
return -EINVAL;
if (params->nulls_base && params->nulls_base < (1U << RHT_BASE_SHIFT))
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] nft_hash: define max_shift rhashtable parameter
2015-02-24 17:25 [PATCH v3 0/2] nft hash resize fixes Josh Hunt
2015-02-24 17:25 ` [PATCH v3 1/2] rhashtable: require max_shift if grow_decision defined Josh Hunt
@ 2015-02-24 17:25 ` Josh Hunt
2015-02-24 17:35 ` [PATCH v3 0/2] nft hash resize fixes Nicolas Dichtel
2 siblings, 0 replies; 5+ messages in thread
From: Josh Hunt @ 2015-02-24 17:25 UTC (permalink / raw)
To: Pablo Neira Ayuso, Patrick McHardy, Thomas Graf
Cc: netfilter-devel, netdev, Daniel Borkmann, Josh Hunt
You must define a max_shift parameter to rhashtable or else the table cannot
grow. This sets max_shift for nft_hash to 24, which will allow the table to
grow to 2^24 or 16 million buckets.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Josh Hunt <johunt@akamai.com>
---
net/netfilter/nft_hash.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index 61e6c40..a32df35 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -23,6 +23,9 @@
/* We target a hash table size of 4, element hint is 75% of final size */
#define NFT_HASH_ELEMENT_HINT 3
+/* Set default of 2^24 buckets or 16 million entries */
+#define NFT_HASH_MAX_BUCKETS 24
+
struct nft_hash_elem {
struct rhash_head node;
struct nft_data key;
@@ -192,6 +195,7 @@ static int nft_hash_init(const struct nft_set *set,
.key_offset = offsetof(struct nft_hash_elem, key),
.key_len = set->klen,
.hashfn = jhash,
+ .max_shift = NFT_HASH_MAX_BUCKETS,
.grow_decision = rht_grow_above_75,
.shrink_decision = rht_shrink_below_30,
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/2] nft hash resize fixes
2015-02-24 17:25 [PATCH v3 0/2] nft hash resize fixes Josh Hunt
2015-02-24 17:25 ` [PATCH v3 1/2] rhashtable: require max_shift if grow_decision defined Josh Hunt
2015-02-24 17:25 ` [PATCH v3 2/2] nft_hash: define max_shift rhashtable parameter Josh Hunt
@ 2015-02-24 17:35 ` Nicolas Dichtel
2015-02-24 17:42 ` Josh Hunt
2 siblings, 1 reply; 5+ messages in thread
From: Nicolas Dichtel @ 2015-02-24 17:35 UTC (permalink / raw)
To: Josh Hunt, Pablo Neira Ayuso, Patrick McHardy, Thomas Graf
Cc: netfilter-devel, netdev, Daniel Borkmann
Le 24/02/2015 18:25, Josh Hunt a écrit :
> v3:
> * Renames NFT_HASH_MAX_ELEMENTS to NFT_HASH_MAX_BUCKETS
> * Add Acked-by for Thomas
>
> Josh Hunt (2):
> rhashtable: require max_shift if grow_decision defined
> nft_hash: define max_shift rhashtable parameter
Patches should be inverted to avoid breaking bisection.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/2] nft hash resize fixes
2015-02-24 17:35 ` [PATCH v3 0/2] nft hash resize fixes Nicolas Dichtel
@ 2015-02-24 17:42 ` Josh Hunt
0 siblings, 0 replies; 5+ messages in thread
From: Josh Hunt @ 2015-02-24 17:42 UTC (permalink / raw)
To: nicolas.dichtel, Pablo Neira Ayuso, Patrick McHardy, Thomas Graf
Cc: netfilter-devel, netdev, Daniel Borkmann
On 02/24/2015 11:35 AM, Nicolas Dichtel wrote:
> Le 24/02/2015 18:25, Josh Hunt a écrit :
>> v3:
>> * Renames NFT_HASH_MAX_ELEMENTS to NFT_HASH_MAX_BUCKETS
>> * Add Acked-by for Thomas
>>
>> Josh Hunt (2):
>> rhashtable: require max_shift if grow_decision defined
>> nft_hash: define max_shift rhashtable parameter
> Patches should be inverted to avoid breaking bisection.
Agreed. Will fix in next rev.
Josh
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-02-24 17:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 17:25 [PATCH v3 0/2] nft hash resize fixes Josh Hunt
2015-02-24 17:25 ` [PATCH v3 1/2] rhashtable: require max_shift if grow_decision defined Josh Hunt
2015-02-24 17:25 ` [PATCH v3 2/2] nft_hash: define max_shift rhashtable parameter Josh Hunt
2015-02-24 17:35 ` [PATCH v3 0/2] nft hash resize fixes Nicolas Dichtel
2015-02-24 17:42 ` Josh Hunt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).