Message ID | 1388956728-6754-4-git-send-email-pablo@netfilter.org |
---|---|
State | Changes Requested |
Headers | show |
On Sun, Jan 05, 2014 at 10:18:48PM +0100, Pablo Neira Ayuso wrote: > Use set->maxelems to calculate the number of buckets that holds a > load factor of 0.75. This patch is perfectly fine of course. > > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> > --- > net/netfilter/nft_hash.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c > index f640c1c..99e4742 100644 > --- a/net/netfilter/nft_hash.c > +++ b/net/netfilter/nft_hash.c > @@ -169,9 +169,7 @@ static int nft_hash_init(const struct nft_set *set, > } > > /* Aim for a load factor of 0.75 */ > - // FIXME: temporarily broken until we have set descriptions > - cnt = 100; > - cnt = cnt * 4 / 3; > + cnt = set->maxelems * 4 / 3; > > priv->hash = kcalloc(cnt, sizeof(struct hlist_head), GFP_KERNEL); > if (priv->hash == NULL) > -- > 1.7.10.4 -- 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
On Sun, Jan 05, 2014 at 09:47:44PM +0000, Patrick McHardy wrote: > On Sun, Jan 05, 2014 at 10:18:48PM +0100, Pablo Neira Ayuso wrote: > > Use set->maxelems to calculate the number of buckets that holds a > > load factor of 0.75. > > This patch is perfectly fine of course. Thanks. So I guess you're fine with 2/3 as well which is needed by this patch. -- 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
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index f640c1c..99e4742 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c @@ -169,9 +169,7 @@ static int nft_hash_init(const struct nft_set *set, } /* Aim for a load factor of 0.75 */ - // FIXME: temporarily broken until we have set descriptions - cnt = 100; - cnt = cnt * 4 / 3; + cnt = set->maxelems * 4 / 3; priv->hash = kcalloc(cnt, sizeof(struct hlist_head), GFP_KERNEL); if (priv->hash == NULL)
Use set->maxelems to calculate the number of buckets that holds a load factor of 0.75. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> --- net/netfilter/nft_hash.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)