mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
	josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
	peterz@infradead.org, rostedt@goodmis.org,
	Valdis.Kletnieks@vt.edu, dhowells@redhat.com,
	eric.dumazet@gmail.com, darren@dvhart.com, patches@linaro.org,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Patrick McHardy <kaber@trash.net>
Subject: [PATCH tip/core/rcu 7/7] net,rcu: convert call_rcu(xt_rateest_free_rcu) to kfree_rcu()
Date: Mon,  2 May 2011 09:13:44 -0700	[thread overview]
Message-ID: <1304352824-6563-7-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110502161321.GA6537@linux.vnet.ibm.com>

The RCU callback xt_rateest_free_rcu() just calls kfree(), so we can
use kfree_rcu() instead of call_rcu().  This also allows us to dispense
with an rcu_barrier() call, speeding up unloading of this module.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/xt_RATEEST.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c
index de079ab..f264032 100644
--- a/net/netfilter/xt_RATEEST.c
+++ b/net/netfilter/xt_RATEEST.c
@@ -60,11 +60,6 @@ struct xt_rateest *xt_rateest_lookup(const char *name)
 }
 EXPORT_SYMBOL_GPL(xt_rateest_lookup);
 
-static void xt_rateest_free_rcu(struct rcu_head *head)
-{
-	kfree(container_of(head, struct xt_rateest, rcu));
-}
-
 void xt_rateest_put(struct xt_rateest *est)
 {
 	mutex_lock(&xt_rateest_mutex);
@@ -75,7 +70,7 @@ void xt_rateest_put(struct xt_rateest *est)
 		 * gen_estimator est_timer() might access est->lock or bstats,
 		 * wait a RCU grace period before freeing 'est'
 		 */
-		call_rcu(&est->rcu, xt_rateest_free_rcu);
+		kfree_rcu(est, rcu);
 	}
 	mutex_unlock(&xt_rateest_mutex);
 }
@@ -188,7 +183,6 @@ static int __init xt_rateest_tg_init(void)
 static void __exit xt_rateest_tg_fini(void)
 {
 	xt_unregister_target(&xt_rateest_tg_reg);
-	rcu_barrier(); /* Wait for completion of call_rcu()'s (xt_rateest_free_rcu) */
 }
 
 
-- 
1.7.3.2


  parent reply	other threads:[~2011-05-02 21:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 16:13 [PATCH tip/core/rcu 0/7] More uses of kfree_rcu Paul E. McKenney
2011-05-02 16:13 ` [PATCH tip/core/rcu 1/7] net,rcu: convert call_rcu(sk_filter_release_rcu) to kfree_rcu Paul E. McKenney
2011-05-02 21:41   ` David Miller
2011-05-02 22:06     ` Paul E. McKenney
2011-05-03  6:13       ` Ingo Molnar
2011-05-03  6:16         ` Ingo Molnar
2011-05-03 19:33           ` Paul E. McKenney
2011-05-02 16:13 ` [PATCH tip/core/rcu 2/7] sysctl,rcu: convert call_rcu(free_head) to kfree Paul E. McKenney
2011-05-02 16:13 ` [PATCH tip/core/rcu 3/7] batman,rcu: convert call_rcu(gw_node_free_rcu) to kfree_rcu Paul E. McKenney
2011-05-02 16:13 ` [PATCH tip/core/rcu 4/7] batman,rcu: convert call_rcu(neigh_node_free_rcu) to kfree() Paul E. McKenney
2011-05-02 16:13 ` [PATCH tip/core/rcu 5/7] batman,rcu: convert call_rcu(softif_neigh_free_rcu) to kfree_rcu Paul E. McKenney
2011-05-03  7:02   ` Sven Eckelmann
2011-05-02 16:13 ` [PATCH tip/core/rcu 6/7] net,rcu: convert call_rcu(prl_entry_destroy_rcu) to kfree Paul E. McKenney
2011-05-02 16:13 ` Paul E. McKenney [this message]
2011-05-03  0:13 ` [PATCH tip/core/rcu 0/7] More uses of kfree_rcu Josh Triplett

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=1304352824-6563-7-git-send-email-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=darren@dvhart.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=eric.dumazet@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=kaber@trash.net \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=niv@us.ibm.com \
    --cc=patches@linaro.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome