More uses of kfree_rcu
Subsystems (7)
cover More uses of kfree_rcu
Hello!
This patchset replaces call_rcu() with kfree_rcu() in a few more places.
Thanx, Paul
include/net/sock.h | 4 +--- kernel/sysctl.c | 11 +++-------- net/batman-adv/gateway_client.c | 10 +--------- net/batman-adv/originator.c | 10 +--------- net/batman-adv/soft-interface.c | 10 +--------- net/core/filter.c | 12 ------------ net/ipv6/sit.c | 7 +------ net/netfilter/xt_RATEEST.c | 8 +------- 8 files changed, 9 insertions(+), 63 deletions(-)
PATCH 1/7 net,rcu: convert call_rcu(sk_filter_release_rcu) to kfree_rcu
The RCU callback sk_filter_release_rcu just calls kfree(), so we use kfree_rcu() instead of call_rcu().
--- include/net/sock.h | 4 +--- net/core/filter.c | 12 ------------ 2 files changed, 1 insertions(+), 15 deletions(-)
include/net/sock.h +1 -3
@@ -1179,8 +1179,6 @@ extern void sk_common_release(struct sock *sk);/* Initialise core socket variables */ extern void sock_init_data (struct socket *sock,struct sock *sk); -extern void sk_filter_release_rcu (struct rcu_head *rcu); -/** * sk_filter_release - release a socket filter * @fp: filter to remove
@@ -1191,7 +1189,7 @@ extern void sk_filter_release_rcu(struct rcu_head *rcu);static inline void sk_filter_release (struct sk_filter *fp) {if (atomic_dec_and_test (&fp->refcnt)) -call_rcu (&fp->rcu, sk_filter_release_rcu); +kfree_rcu (fp, rcu); }static inline void sk_filter_uncharge (struct sock *sk,struct sk_filter *fp)
net/core/filter.c +0 -12
@@ -631,18 +631,6 @@ int sk_chk_filter(struct sock_filter *filter, int flen)EXPORT_SYMBOL (sk_chk_filter);/** -* sk_filter_release_rcu - Release a socket filter by rcu_head -* @rcu: rcu_head that contains the sk_filter to free -*/ -void sk_filter_release_rcu (struct rcu_head *rcu) -{ - struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); - -kfree (fp); -} -EXPORT_SYMBOL (sk_filter_release_rcu); - -/** * sk_attach_filter - attach a socket filter * @fprog: the filter program * @sk: the socket to use
Signature · 1 line
1.7.3.2
Re: [PATCH tip/core/rcu 1/7] net,rcu: convert call_rcu(sk_filter_release_rcu) to kfree_rcu
From: "Paul E. McKenney" <[email protected]>
Date: Mon, 2 May 2011 09:13:38 -0700
Quoted 4 lines
The RCU callback
sk_filter_release_rcujust callskfree(), so we usekfree_rcu()instead ofcall_rcu().Signed-off-by Paul E. McKenney <[email protected]>
I'm fine with all of these net conversions:
Re: [PATCH tip/core/rcu 1/7] net,rcu: convert call_rcu(sk_filter_release_rcu) to kfree_rcu
Quoted 11 lines · David Miller
From: "Paul E. McKenney" <[email protected]>
Date: Mon, 2 May 2011 09:13:38 -0700Quoted 4 lines
The RCU callback
sk_filter_release_rcujust callskfree(), so we usekfree_rcu()instead ofcall_rcu().Signed-off-by Paul E. McKenney <[email protected]>I'm fine with all of these net conversions:
Acked-by David S. Miller <[email protected]>
Thank you, Dave!
Thanx, Paul
Re: [PATCH tip/core/rcu 1/7] net,rcu: convert call_rcu(sk_filter_release_rcu) to kfree_rcu
Quoted 7 lines · Paul E. McKenney
Quoted 6 lines · David Miller
From: "Paul E. McKenney" <[email protected]>
Date: Mon, 2 May 2011 09:13:38 -0700Quoted 3 lines
The RCU callback
sk_filter_release_rcujust callskfree(), so we usekfree_rcu()instead ofcall_rcu().
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Paul E. McKenney <[email protected]>I'm fine with all of these net conversions:
Acked-by David S. Miller <[email protected]>Thank you, Dave!
Looking at the networking-only diffstat i suspect the best flow would be if Dave pulled these from you into the networking tree?
Thanks,
Ingo
Re: [PATCH tip/core/rcu 1/7] net,rcu: convert call_rcu(sk_filter_release_rcu) to kfree_rcu
Quoted 12 lines · Ingo Molnar
Quoted 9 lines · Paul E. McKenney
Quoted 8 lines · David Miller
From: "Paul E. McKenney" <[email protected]>
Date: Mon, 2 May 2011 09:13:38 -0700Quoted 4 lines
The RCU callback
sk_filter_release_rcujust callskfree(), so we usekfree_rcu()instead ofcall_rcu().Signed-off-by Paul E. McKenney <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I'm fine with all of these net conversions:
Acked-by David S. Miller <[email protected]>Thank you, Dave!
Looking at the networking-only diffstat i suspect the best flow would be if Dave pulled these from you into the networking tree?
Oh, but kfree_rcu() is not upstream yet, right? So it has to be in the RCU tree.
Thanks,
Ingo
Re: [PATCH tip/core/rcu 1/7] net,rcu: convert call_rcu(sk_filter_release_rcu) to kfree_rcu
Quoted 19 lines · Ingo Molnar
Quoted 16 lines · Ingo Molnar
Quoted 13 lines · Paul E. McKenney
Quoted 11 lines · David Miller
From: "Paul E. McKenney" <[email protected]>
Date: Mon, 2 May 2011 09:13:38 -0700Quoted 4 lines
The RCU callback
sk_filter_release_rcujust callskfree(), so we usekfree_rcu()instead ofcall_rcu().Signed-off-by Paul E. McKenney <[email protected]>I'm fine with all of these net conversions:
Acked-by David S. Miller <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thank you, Dave!
Looking at the networking-only diffstat i suspect the best flow would be if Dave pulled these from you into the networking tree?
Oh, but
kfree_rcu()is not upstream yet, right? So it has to be in the RCU tree.
Yep! So I either need to get kfree_rcu() upstream, then push up Dave's tree, or I need to push them all up -tip. Either way is fine by me.
Thanx, Paul
PATCH 2/7 sysctl,rcu: convert call_rcu(free_head) to kfree
In reply to Paul E. McKenneyThe RCU callback free_head just calls kfree(), so we can use kfree_rcu() instead of call_rcu().
--- kernel/sysctl.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-)
kernel/sysctl.c +3 -8
@@ -1574,16 +1574,11 @@ void sysctl_head_get(struct ctl_table_header *head)spin_unlock (&sysctl_lock); } -static void free_head (struct rcu_head *rcu) -{ -kfree (container_of(rcu ,struct ctl_table_header ,rcu )); -} -void sysctl_head_put (struct ctl_table_header *head) {spin_lock (&sysctl_lock);if (!--head->count) -call_rcu (&head->rcu, free_head); +kfree_rcu (head, rcu);spin_unlock (&sysctl_lock); }
@@ -1955,10 +1950,10 @@ void unregister_sysctl_table(struct ctl_table_header * header)start_unregistering (header);if (!--header->parent->count) {WARN_ON (1 ); -call_rcu (&header->parent->rcu, free_head); +kfree_rcu (header->parent, rcu); }if (!--header->count) -call_rcu (&header->rcu, free_head); +kfree_rcu (header, rcu);spin_unlock (&sysctl_lock); }
Signature · 1 line
1.7.3.2
PATCH 3/7 batman,rcu: convert call_rcu(gw_node_free_rcu) to kfree_rcu
In reply to Paul E. McKenneyThe RCU callback gw_node_free_rcu() just calls kfree(), so we can use kfree_rcu() instead of call_rcu().
--- net/batman-adv/gateway_client.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-)
net/batman-adv/gateway_client.c +1 -9
@@ -28,18 +28,10 @@#include <linux/udp.h> #include <linux/if_vlan.h> -static void gw_node_free_rcu (struct rcu_head *rcu) -{ -struct gw_node *gw_node; - - gw_node = container_of(rcu, struct gw_node, rcu); -kfree (gw_node); -} -static void gw_node_free_ref (struct gw_node *gw_node) {if (atomic_dec_and_test (&gw_node->refcount)) -call_rcu (&gw_node->rcu, gw_node_free_rcu); +kfree_rcu (gw_node, rcu); }void *gw_get_selected (struct bat_priv *bat_priv)
Signature · 1 line
1.7.3.2
PATCH 4/7 batman,rcu: convert call_rcu(neigh_node_free_rcu) to kfree()
In reply to Paul E. McKenneyThe RCU callback neigh_node_free_rcu() just calls kfree(), so we can use kfree_rcu() instead of call_rcu().
--- net/batman-adv/originator.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-)
net/batman-adv/originator.c +1 -9
@@ -56,18 +56,10 @@ err:return 0 ; } -static void neigh_node_free_rcu (struct rcu_head *rcu) -{ -struct neigh_node *neigh_node; - - neigh_node = container_of(rcu, struct neigh_node, rcu); -kfree (neigh_node); -} -void neigh_node_free_ref (struct neigh_node *neigh_node) {if (atomic_dec_and_test (&neigh_node->refcount)) -call_rcu (&neigh_node->rcu, neigh_node_free_rcu); +kfree_rcu (neigh_node, rcu); } struct neigh_node *create_neighbor(struct orig_node *orig_node,
Signature · 1 line
1.7.3.2
PATCH 5/7 batman,rcu: convert call_rcu(softif_neigh_free_rcu) to kfree_rcu
In reply to Paul E. McKenneyThe RCU callback softif_neigh_free_rcu() just calls kfree(), so we can use kfree_rcu() instead of call_rcu().
--- net/batman-adv/soft-interface.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-)
net/batman-adv/soft-interface.c +1 -9
@@ -76,18 +76,10 @@ int my_skb_head_push(struct sk_buff *skb, unsigned int len)return 0 ; } -static void softif_neigh_free_rcu (struct rcu_head *rcu) -{ -struct softif_neigh *softif_neigh; - - softif_neigh = container_of(rcu, struct softif_neigh, rcu); -kfree (softif_neigh); -} -static void softif_neigh_free_ref (struct softif_neigh *softif_neigh) {if (atomic_dec_and_test (&softif_neigh->refcount)) -call_rcu (&softif_neigh->rcu, softif_neigh_free_rcu); +kfree_rcu (softif_neigh, rcu); }void softif_neigh_purge (struct bat_priv *bat_priv)
Signature · 1 line
1.7.3.2
Re: [PATCH tip/core/rcu 5/7] batman,rcu: convert call_rcu(softif_neigh_free_rcu) to kfree_rcu
Quoted 3 lines · On Monday 02 May 2011 18:13:42 Paul E. McKenney wrote:
The RCU callback
softif_neigh_free_rcu()just callskfree(), so we can usekfree_rcu()instead ofcall_rcu().
[...]
Quoted 2 lines
The RCU callback
neigh_node_free_rcu()just callskfree(), so we can usekfree_rcu()instead ofcall_rcu().
[...]
Quoted 2 lines
The RCU callback
gw_node_free_rcu()just callskfree(), so we can usekfree_rcu()instead ofcall_rcu().
Thanks, I am fine with Patch 3/7, 4/7, 5/7.
PATCH 6/7 net,rcu: convert call_rcu(prl_entry_destroy_rcu) to kfree
In reply to Paul E. McKenneyThe RCU callback prl_entry_destroy_rcu() just calls kfree(), so we can use kfree_rcu() instead of call_rcu().
--- net/ipv6/sit.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
net/ipv6/sit.c +1 -6
@@ -401,11 +401,6 @@ out:return err; } -static void prl_entry_destroy_rcu (struct rcu_head *head) -{ -kfree (container_of(head ,struct ip_tunnel_prl_entry ,rcu_head )); -} -static void prl_list_destroy_rcu (struct rcu_head *head) {struct ip_tunnel_prl_entry *p, *n;
@@ -433,7 +428,7 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) p = &x->next) {if (x->addr == a->addr) { *p = x->next; -call_rcu (&x->rcu_head, prl_entry_destroy_rcu); +kfree_rcu (x, rcu_head); t->prl_count--; goto out; }
Signature · 1 line
1.7.3.2
PATCH 7/7 net,rcu: convert call_rcu(xt_rateest_free_rcu) to kfree_rcu()
In reply to Paul E. McKenneyThe 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.
--- net/netfilter/xt_RATEEST.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
net/netfilter/xt_RATEEST.c +1 -7
@@ -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) */ }
Signature · 1 line
1.7.3.2
Quoted 1 line · Paul E. McKenney
This patchset replaces
call_rcu()withkfree_rcu()in a few more places.
For all 7 of these conversions: