Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 -7
+1 -7
net/netfilter/xt_RATEEST.c
··· 60 60 } 61 61 EXPORT_SYMBOL_GPL(xt_rateest_lookup); 62 62 63 - static void xt_rateest_free_rcu(struct rcu_head *head) 64 - { 65 - kfree(container_of(head, struct xt_rateest, rcu)); 66 - } 67 - 68 63 void xt_rateest_put(struct xt_rateest *est) 69 64 { 70 65 mutex_lock(&xt_rateest_mutex); ··· 70 75 * gen_estimator est_timer() might access est->lock or bstats, 71 76 * wait a RCU grace period before freeing 'est' 72 77 */ 73 - call_rcu(&est->rcu, xt_rateest_free_rcu); 78 + kfree_rcu(est, rcu); 74 79 } 75 80 mutex_unlock(&xt_rateest_mutex); 76 81 } ··· 183 188 static void __exit xt_rateest_tg_fini(void) 184 189 { 185 190 xt_unregister_target(&xt_rateest_tg_reg); 186 - rcu_barrier(); /* Wait for completion of call_rcu()'s (xt_rateest_free_rcu) */ 187 191 } 188 192 189 193