netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2] rhashtable: Warn if min_size or max_size are not a power of two
Date: Thu, 19 Mar 2015 21:15:46 +0000	[thread overview]
Message-ID: <20150319211546.GA4190@casper.infradead.org> (raw)
In-Reply-To: <20150319210239.GB9601@gondor.apana.org.au>

On 03/20/15 at 08:02am, Herbert Xu wrote:
> On Thu, Mar 19, 2015 at 07:46:08PM +0000, Thomas Graf wrote:
> > The current code correctly limits table size to the next power of two.
> > This check is solely to catch programming errors.
> > 
> > Signed-off-by: Thomas Graf <tgraf@suug.ch>
> 
> I don't see the point of this.  A maximum size of 3 says that
> the table size should never exceed 3 which makes perfect sense.
> And our current code will respect that.
> 
> So why force it to be a power of 2 just because our table sizes
> happen to be powers of 2?

rht_grow_above_75() checks the old table size:

(!ht->p.max_size || tbl->size < ht->p.max_size);

If you specify max_size = 3, it grows the table to tbl->size = 4.
This can be avoided if max_size is a power of two.

  reply	other threads:[~2015-03-19 21:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 16:34 [PATCH net-next] rhashtable: Warn if min_size or max_size are not a power of two Thomas Graf
2015-03-19 19:24 ` David Miller
2015-03-19 19:46   ` [PATCH net-next v2] " Thomas Graf
2015-03-19 21:02     ` Herbert Xu
2015-03-19 21:15       ` Thomas Graf [this message]
2015-03-19 21:49         ` Herbert Xu
2015-03-19 22:02           ` Herbert Xu
2015-03-19 22:31             ` [PATCH net-next] rhashtable: Round up/down min/max_size to ensure we respect limit Thomas Graf
2015-03-19 22:41               ` Herbert Xu
2015-03-20  1:02               ` David Miller
2015-03-20 10:57           ` [PATCH net-next v2] rhashtable: Warn if min_size or max_size are not a power of two David Laight

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=20150319211546.GA4190@casper.infradead.org \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).