All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org,
	josh@joshtriplett.org, paulmck@linux.vnet.ibm.com
Subject: Re: [PATCH v2] netfilter: nft_hash: bug fixes and resizing
Date: Fri, 28 Feb 2014 14:35:43 +0000	[thread overview]
Message-ID: <20140228143542.GA6813@macbook.localnet> (raw)
In-Reply-To: <1393597454.26794.62.camel@edumazet-glaptop2.roam.corp.google.com>

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.

      reply	other threads:[~2014-02-28 14:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28 13:48 [PATCH v2] netfilter: hash resizing Patrick McHardy
2014-02-28 13:48 ` [PATCH v2] netfilter: nft_hash: bug fixes and resizing Patrick McHardy
2014-02-28 14:24   ` Eric Dumazet
2014-02-28 14:35     ` Patrick McHardy [this message]

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=20140228143542.GA6813@macbook.localnet \
    --to=kaber@trash.net \
    --cc=eric.dumazet@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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.