From: Josh Hunt <johunt@akamai.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
kaber@trash.net, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org
Subject: nft hash set expansion problem
Date: Sun, 08 Feb 2015 13:38:59 -0600 [thread overview]
Message-ID: <54D7BB53.2050203@akamai.com> (raw)
Nft hash sets are unable to expand past the initial # of buckets. This
is b/c nft hash sets don't define the max_shift parameter and so
rht_grow_above_75():
return atomic_read(&ht->nelems) > (new_size / 4 * 3) &&
(ht->p.max_shift && atomic_read(&ht->shift) <
ht->p.max_shift);
can't return true.
It's not clear to me if this is intentional; requiring users of
rhashtables define a max_shift in order to support expansion, or a bug
in the grow decision function?
Here's a possible fix if it's the latter. Let me know and I can submit
something formal if that's the case.
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index e96fc00..2c51617 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -250,7 +250,7 @@ bool rht_grow_above_75(const struct rhashtable *ht,
size_t new_size)
{
/* Expand table when exceeding 75% load */
return atomic_read(&ht->nelems) > (new_size / 4 * 3) &&
- (ht->p.max_shift && atomic_read(&ht->shift) <
ht->p.max_shift);
+ (ht->p.max_shift ? atomic_read(&ht->shift) <
ht->p.max_shift : 1);
}
EXPORT_SYMBOL_GPL(rht_grow_above_75);
Thanks
Josh
next reply other threads:[~2015-02-08 19:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-08 19:38 Josh Hunt [this message]
2015-02-08 22:43 ` nft hash set expansion problem Daniel Borkmann
2015-02-09 14:44 ` Josh Hunt
2015-02-09 15:21 ` Thomas Graf
2015-02-09 15:28 ` Josh Hunt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54D7BB53.2050203@akamai.com \
--to=johunt@akamai.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.