Skip to content

Commit cefcb60

Browse files
committed
net,rcu: Convert call_rcu(xt_rateest_free_rcu) to kfree_rcu()
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> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
1 parent a95cded commit cefcb60

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

‎net/netfilter/xt_RATEEST.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ struct xt_rateest *xt_rateest_lookup(const char *name)
6060
}
6161
EXPORT_SYMBOL_GPL(xt_rateest_lookup);
6262

63-
static void xt_rateest_free_rcu(struct rcu_head *head)
64-
{
65-
kfree(container_of(head, struct xt_rateest, rcu));
66-
}
67-
6863
void xt_rateest_put(struct xt_rateest *est)
6964
{
7065
mutex_lock(&xt_rateest_mutex);
@@ -75,7 +70,7 @@ void xt_rateest_put(struct xt_rateest *est)
7570
* gen_estimator est_timer() might access est->lock or bstats,
7671
* wait a RCU grace period before freeing 'est'
7772
*/
78-
call_rcu(&est->rcu, xt_rateest_free_rcu);
73+
kfree_rcu(est, rcu);
7974
}
8075
mutex_unlock(&xt_rateest_mutex);
8176
}
@@ -188,7 +183,6 @@ static int __init xt_rateest_tg_init(void)
188183
static void __exit xt_rateest_tg_fini(void)
189184
{
190185
xt_unregister_target(&xt_rateest_tg_reg);
191-
rcu_barrier(); /* Wait for completion of call_rcu()'s (xt_rateest_free_rcu) */
192186
}
193187

194188

0 commit comments

Comments
 (0)