From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 3/3] netfilter: nft_hash: use set->maxelems to calculate number of buckets
Date: Sun, 5 Jan 2014 21:47:44 +0000 [thread overview]
Message-ID: <20140105214744.GA18655@macbook.localnet> (raw)
In-Reply-To: <1388956728-6754-4-git-send-email-pablo@netfilter.org>
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
next prev parent reply other threads:[~2014-01-05 21:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-05 21:18 [PATCH 0/3 nftables RFC] set infrastructure updates Pablo Neira Ayuso
2014-01-05 21:18 ` [PATCH 1/3] netfilter: nf_tables: fix suboptimal set selection Pablo Neira Ayuso
2014-01-05 21:28 ` Patrick McHardy
2014-01-05 21:34 ` Pablo Neira Ayuso
2014-01-05 21:45 ` Patrick McHardy
2014-01-05 22:11 ` Pablo Neira Ayuso
2014-01-05 22:21 ` Patrick McHardy
2014-01-05 21:18 ` [PATCH 2/3] netfilter: nf_tables: limit maximum number of elements Pablo Neira Ayuso
2014-01-05 21:51 ` Patrick McHardy
2014-01-05 22:14 ` Pablo Neira Ayuso
2014-01-05 22:15 ` Pablo Neira Ayuso
2014-01-05 22:25 ` Patrick McHardy
2014-01-05 21:18 ` [PATCH 3/3] netfilter: nft_hash: use set->maxelems to calculate number of buckets Pablo Neira Ayuso
2014-01-05 21:47 ` Patrick McHardy [this message]
2014-01-05 22:12 ` Pablo Neira Ayuso
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=20140105214744.GA18655@macbook.localnet \
--to=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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.