From: Thomas Graf <tgraf@suug.ch>
To: Ying Xue <ying.xue@windriver.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
jon.maloy@ericsson.com, Paul.Gortmaker@windriver.com,
erik.hugne@ericsson.com, tipc-discussion@lists.sourceforge.net
Subject: Re: [PATCH net-next 2/5] rhashtable: introduce rhashtable_wakeup_worker helper function
Date: Tue, 6 Jan 2015 09:29:48 +0000 [thread overview]
Message-ID: <20150106092948.GB12468@casper.infradead.org> (raw)
In-Reply-To: <1420529003-22244-3-git-send-email-ying.xue@windriver.com>
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@windriver.com>
> Cc: Thomas Graf <tgraf@suug.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.
next prev parent reply other threads:[~2015-01-06 9:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 7:23 [PATCH net-next 0/5] Involve rhashtable_lookup_insert routine Ying Xue
2015-01-06 7:23 ` [PATCH net-next 1/5] rhashtable: optimize rhashtable_lookup routine Ying Xue
2015-01-06 9:13 ` Thomas Graf
2015-01-06 7:23 ` [PATCH net-next 2/5] rhashtable: introduce rhashtable_wakeup_worker helper function Ying Xue
2015-01-06 9:29 ` Thomas Graf [this message]
2015-01-06 7:23 ` [PATCH net-next 3/5] rhashtable: use future table size to make expansion decision Ying Xue
2015-01-06 9:35 ` Thomas Graf
2015-01-06 9:56 ` Ying Xue
2015-01-06 10:06 ` Thomas Graf
2015-01-06 7:23 ` [PATCH net-next 4/5] rhashtable: involve rhashtable_lookup_insert routine Ying Xue
2015-01-06 9:41 ` Thomas Graf
2015-01-06 7:23 ` [PATCH net-next 5/5] tipc: convert tipc reference table to use generic rhashtable Ying Xue
2015-01-06 9:42 ` Thomas Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150106092948.GB12468@casper.infradead.org \
--to=tgraf@suug.ch \
--cc=Paul.Gortmaker@windriver.com \
--cc=davem@davemloft.net \
--cc=erik.hugne@ericsson.com \
--cc=jon.maloy@ericsson.com \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).