Re: [PATCH v2] netfilter: nft_hash: bug fixes and resizing

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

 



On Fri, Feb 28, 2014 at 06:24:14AM -0800, Eric Dumazet wrote:
> On Fri, 2014-02-28 at 13:48 +0000, Patrick McHardy wrote:
> 
> > +
> > +static struct nft_hash_table *nft_hash_tbl_alloc(unsigned int nbuckets)
> > +{
> > +	struct nft_hash_table *tbl;
> > +	size_t size;
> > +
> > +	size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]);
> > +	tbl = kzalloc(size, GFP_KERNEL);
> > +	if (tbl == NULL)
> > +		tbl = vzalloc(size);
> 
> There is no limit on nbuckets ?

I'm not sure whether we want a limit. The promise is to deliver O(1)
lookup performance. If the user adds millions of elements, this will
require a bit of memory. The hash might also not be the best set
implementation in that case, the (upcoming) array mapped trie will
do a lot better if it can be used.

> You might consider using __GFP_REPEAT | __GFP_NOWARN

Thanks, I'll change it.
--
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