[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB0527A@AcuExch.aculab.com>
Date: Fri, 20 Mar 2015 10:57:45 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Herbert Xu' <herbert@...dor.apana.org.au>,
Thomas Graf <tgraf@...g.ch>
CC: David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next v2] rhashtable: Warn if min_size or max_size
are not a power of two
From: Herbert Xu
> Sent: 19 March 2015 21:50
> On Thu, Mar 19, 2015 at 09:15:46PM +0000, Thomas Graf wrote:
> >
> > 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.
>
> OK let's fix the test then. The easiest way would be to round
> max_size up to the next power of 2.
Isn't that round-up implicit in the test above, no reason to
change the user-supplied limit.
To round down just test tbl->size * 2 <= ht->p.max_size.
Maybe just document the fact that it will grow if the current size is
less than the requested maximum.
David
--
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