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]
Date:	Tue, 6 Jan 2015 09:29:48 +0000
From:	Thomas Graf <tgraf@...g.ch>
To:	Ying Xue <ying.xue@...driver.com>
Cc:	davem@...emloft.net, netdev@...r.kernel.org,
	jon.maloy@...csson.com, Paul.Gortmaker@...driver.com,
	erik.hugne@...csson.com, tipc-discussion@...ts.sourceforge.net
Subject: Re: [PATCH net-next 2/5] rhashtable: introduce
 rhashtable_wakeup_worker helper function

On 01/06/15 at 03:23pm, Ying Xue wrote:
> Introduce rhashtable_wakeup_worker() helper function to reduce
> duplicated code where to wake up worker.
> 
> Signed-off-by: Ying Xue <ying.xue@...driver.com>
> Cc: Thomas Graf <tgraf@...g.ch>
> ---
>  lib/rhashtable.c |   20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index f2fdd7a..6eda22f 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
> @@ -492,6 +492,17 @@ static void rht_deferred_worker(struct work_struct *work)
>  	mutex_unlock(&ht->mutex);
>  }
>  
> +static void rhashtable_wakeup_worker(struct rhashtable *ht)
> +{
> +	struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht);
> +	struct bucket_table *new_tbl = rht_dereference_rcu(ht->future_tbl, ht);
> +
> +	if (ht->tbl != ht->future_tbl &&

I just noticed that this is a bug in the original code. It should be

	if (ht->tbl == ht->future_tbl &&

Do you want to fix this in this series?


> +	    ((ht->p.grow_decision && ht->p.grow_decision(ht, new_tbl->size)) ||
> +	    (ht->p.shrink_decision && ht->p.shrink_decision(ht, tbl->size))))

Indent to inner brakcet

> +		schedule_delayed_work(&ht->run_work, 0);
> +}
> +
>  /**
>   * rhashtable_insert - insert object into hash hash table
>   * @ht:		hash table
> @@ -533,9 +544,7 @@ void rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj)
>  	atomic_inc(&ht->nelems);
>  
>  	/* Only grow the table if no resizing is currently in progress. */

This comment should be moved to the function as well.
--
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