diff mbox

[tip/core/rcu,2/7] sysctl,rcu: convert call_rcu(free_head) to kfree

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

Commit Message

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

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 kernel/sysctl.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c0bb324..39dbad0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -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);
 }