]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Feb 2019 04:53:01 +0000 (04:53 +0000)
commitcc6fce1f50356540778f9eb052fdf6dd7f971b2a
treea31ea66a8095fdd8ceeeae3af1c85ddd9e046cfb
parent1d5dc0608c5662c779fbc29312f438e51d6ad540
lib/rhashtable: consider param->min_size when setting initial table size

BugLink: http://bugs.launchpad.net/bugs/1812229
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
lib/rhashtable.c