lib/rhashtable: consider param->min_size when setting initial table size
authorDavidlohr Bueso <dave@stgolabs.net>
Mon, 16 Jul 2018 20:26:13 +0000 (13:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Jul 2018 09:25:09 +0000 (11:25 +0200)
commitcfb876dc30429879584dde6ced2b18f8d0757b3e
treeebf8c21eb7f637c1e27b963373785418723ebbae
parent9f7276ce825bb1324dca2515d7b5e5d320af77f2
lib/rhashtable: consider param->min_size when setting initial table size

[ Upstream commit 107d01f5ba10f4162c38109496607eb197059064 ]

rhashtable_init() currently does not take into account the user-passed
min_size parameter unless param->nelem_hint is set as well. As such,
the default size (number of buckets) will always be HASH_DEFAULT_SIZE
even if the smallest allowed size is larger than that. Remediate this
by unconditionally calling into rounded_hashtable_size() and handling
things accordingly.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/rhashtable.c