Re: [PATCH 3/3] netfilter: nft_hash: use set->maxelems to calculate number of buckets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux