[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150319211546.GA4190@casper.infradead.org>
Date: Thu, 19 Mar 2015 21:15:46 +0000
From: Thomas Graf <tgraf@...g.ch>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2] rhashtable: Warn if min_size or max_size are
not a power of two
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@...g.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists