diff mbox

[tip/core/rcu,1/7] net,rcu: convert call_rcu(sk_filter_release_rcu) to kfree_rcu

Message ID 1304352824-6563-1-git-send-email-paulmck@linux.vnet.ibm.com
State New
Headers show

Commit Message

Paul E. McKenney May 2, 2011, 4:13 p.m. UTC
The RCU callback sk_filter_release_rcu just calls kfree(), so we use
kfree_rcu() instead of call_rcu().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Patrick McHardy <kaber@trash.net>
Cc: David S. Miller <davem@davemloft.net>
---
 include/net/sock.h |    4 +---
 net/core/filter.c  |   12 ------------
 2 files changed, 1 insertions(+), 15 deletions(-)

Comments

Ingo Molnar May 3, 2011, 6:13 a.m. UTC | #1
* Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

> On Mon, May 02, 2011 at 02:41:56PM -0700, David Miller wrote:
> > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > Date: Mon,  2 May 2011 09:13:38 -0700
> > 
> > > The RCU callback sk_filter_release_rcu just calls kfree(), so we use
> > > kfree_rcu() instead of call_rcu().
> > > 
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > 
> > I'm fine with all of these net conversions:
> > 
> > Acked-by: David S. Miller <davem@davemloft.net>
> 
> 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
Ingo Molnar May 3, 2011, 6:16 a.m. UTC | #2
* Ingo Molnar <mingo@elte.hu> wrote:

> 
> * Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> 
> > On Mon, May 02, 2011 at 02:41:56PM -0700, David Miller wrote:
> > > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > > Date: Mon,  2 May 2011 09:13:38 -0700
> > > 
> > > > The RCU callback sk_filter_release_rcu just calls kfree(), so we use
> > > > kfree_rcu() instead of call_rcu().
> > > > 
> > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > 
> > > I'm fine with all of these net conversions:
> > > 
> > > Acked-by: David S. Miller <davem@davemloft.net>
> > 
> > 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
Paul E. McKenney May 3, 2011, 7:33 p.m. UTC | #3
On Tue, May 03, 2011 at 08:16:04AM +0200, Ingo Molnar wrote:
> 
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > 
> > * Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> > 
> > > On Mon, May 02, 2011 at 02:41:56PM -0700, David Miller wrote:
> > > > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > > > Date: Mon,  2 May 2011 09:13:38 -0700
> > > > 
> > > > > The RCU callback sk_filter_release_rcu just calls kfree(), so we use
> > > > > kfree_rcu() instead of call_rcu().
> > > > > 
> > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > 
> > > > I'm fine with all of these net conversions:
> > > > 
> > > > Acked-by: David S. Miller <davem@davemloft.net>
> > > 
> > > 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
diff mbox

Patch

diff --git a/include/net/sock.h b/include/net/sock.h
index 01810a3..60caa06 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -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)
diff --git a/net/core/filter.c b/net/core/filter.c
index afb8afb..7195ce0 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -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