lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140829093107.GA3563@casper.infradead.org>
Date:	Fri, 29 Aug 2014 10:31:07 +0100
From:	Thomas Graf <tgraf@...g.ch>
To:	Ying Xue <ying.xue@...driver.com>
Cc:	davem@...emloft.net, eric.dumazet@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2] lib/rhashtable: allow users to set the
 minimum shifts of shrinking

On 08/28/14 at 09:45am, Ying Xue wrote:
> Now the resizeable hash table size is allowed to shrink a too smaller
> size - HASH_MIN_SIZE(4) although users initially specify a rather big
> size when table is created. Especially when the number of objects
> saved in the table keeps a small value in comparison with the initial
> setting of table size during a quite long time, lots of actions of
> expanding and shrinking are involved with objects being inserted or

Can you work on this part of the commit message a bit? I know what
you want to say but it's not very clear from the text.

> removed from table. However, as synchronize_rcu() has to be called
> during expanding and shrinking, these unnecessary actions would
> seriously hit users' performance.
> 
> Therefore, we should permit users to set the minimum table size
> through configuring the minimum of number of shifts when table is
> created according to users specific requirement.
> 
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index a2c7881..85a4ac2 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
> @@ -566,8 +568,13 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
>  	    (!params->key_len && !params->obj_hashfn))
>  		return -EINVAL;
>  
> +	if (params->min_shift)
> +		params->min_shift = max(params->min_shift, min_shift);
> +	else
> +		params->min_shift = min_shift;
> +

You can simplify all of the above to just:

  params->min_shift = max(params->min_shift, ilog2(HASH_MIN_SIZE));
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ