diff options
author | Andreea-Cristina Bernat <bernat.ada@gmail.com> | 2014-03-18 14:48:48 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-04-29 11:45:01 -0400 |
commit | 495aa969dbaef2e3d28094a2b3c752d069932748 (patch) | |
tree | 4ffd39866a013c28d7918986b23b4e4dc8c499f7 | |
parent | 595f3900f6b4221403493c530138b8dad2bd87f3 (diff) |
rcu: Consolidate kfree_call_rcu() to use rcu_state pointer
kfree_call_rcu is defined two times. When defined under CONFIG_TREE_PREEMPT_RCU,
it uses rcu_preempt_state. Otherwise, it uses rcu_sched_state.
This patch uses the rcu_state_pointer to combine the two definitions into one.
The resulting function is placed after the closing of the preprocessor
conditional CONFIG_TREE_PREEMPT_RCU.
Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
-rw-r--r-- | kernel/rcu/tree.c | 14 | ||||
-rw-r--r-- | kernel/rcu/tree_plugin.h | 30 |
2 files changed, 14 insertions, 30 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 6724bd98da7d..f3317c18b354 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
@@ -2598,6 +2598,20 @@ void call_rcu_bh(struct rcu_head *head, void (*func)(struct rcu_head *rcu)) | |||
2598 | EXPORT_SYMBOL_GPL(call_rcu_bh); | 2598 | EXPORT_SYMBOL_GPL(call_rcu_bh); |
2599 | 2599 | ||
2600 | /* | 2600 | /* |
2601 | * Queue an RCU callback for lazy invocation after a grace period. | ||
2602 | * This will likely be later named something like "call_rcu_lazy()", | ||
2603 | * but this change will require some way of tagging the lazy RCU | ||
2604 | * callbacks in the list of pending callbacks. Until then, this | ||
2605 | * function may only be called from __kfree_rcu(). | ||
2606 | */ | ||
2607 | void kfree_call_rcu(struct rcu_head *head, | ||
2608 | void (*func)(struct rcu_head *rcu)) | ||
2609 | { | ||
2610 | __call_rcu(head, func, rcu_state, -1, 1); | ||
2611 | } | ||
2612 | EXPORT_SYMBOL_GPL(kfree_call_rcu); | ||
2613 | |||
2614 | /* | ||
2601 | * Because a context switch is a grace period for RCU-sched and RCU-bh, | 2615 | * Because a context switch is a grace period for RCU-sched and RCU-bh, |
2602 | * any blocking grace-period wait automatically implies a grace period | 2616 | * any blocking grace-period wait automatically implies a grace period |
2603 | * if there is only one CPU online at any point time during execution | 2617 | * if there is only one CPU online at any point time during execution |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 0cb0816036c5..4918a1243efb 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -688,20 +688,6 @@ void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)) | |||
688 | } | 688 | } |
689 | EXPORT_SYMBOL_GPL(call_rcu); | 689 | EXPORT_SYMBOL_GPL(call_rcu); |
690 | 690 | ||
691 | /* | ||
692 | * Queue an RCU callback for lazy invocation after a grace period. | ||
693 | * This will likely be later named something like "call_rcu_lazy()", | ||
694 | * but this change will require some way of tagging the lazy RCU | ||
695 | * callbacks in the list of pending callbacks. Until then, this | ||
696 | * function may only be called from __kfree_rcu(). | ||
697 | */ | ||
698 | void kfree_call_rcu(struct rcu_head *head, | ||
699 | void (*func)(struct rcu_head *rcu)) | ||
700 | { | ||
701 | __call_rcu(head, func, &rcu_preempt_state, -1, 1); | ||
702 | } | ||
703 | EXPORT_SYMBOL_GPL(kfree_call_rcu); | ||
704 | |||
705 | /** | 691 | /** |
706 | * synchronize_rcu - wait until a grace period has elapsed. | 692 | * synchronize_rcu - wait until a grace period has elapsed. |
707 | * | 693 | * |
@@ -1080,22 +1066,6 @@ static void rcu_preempt_check_callbacks(int cpu) | |||
1080 | } | 1066 | } |
1081 | 1067 | ||
1082 | /* | 1068 | /* |
1083 | * Queue an RCU callback for lazy invocation after a grace period. | ||
1084 | * This will likely be later named something like "call_rcu_lazy()", | ||
1085 | * but this change will require some way of tagging the lazy RCU | ||
1086 | * callbacks in the list of pending callbacks. Until then, this | ||
1087 | * function may only be called from __kfree_rcu(). | ||
1088 | * | ||
1089 | * Because there is no preemptible RCU, we use RCU-sched instead. | ||
1090 | */ | ||
1091 | void kfree_call_rcu(struct rcu_head *head, | ||
1092 | void (*func)(struct rcu_head *rcu)) | ||
1093 | { | ||
1094 | __call_rcu(head, func, &rcu_sched_state, -1, 1); | ||
1095 | } | ||
1096 | EXPORT_SYMBOL_GPL(kfree_call_rcu); | ||
1097 | |||
1098 | /* | ||
1099 | * Wait for an rcu-preempt grace period, but make it happen quickly. | 1069 | * Wait for an rcu-preempt grace period, but make it happen quickly. |
1100 | * But because preemptible RCU does not exist, map to rcu-sched. | 1070 | * But because preemptible RCU does not exist, map to rcu-sched. |
1101 | */ | 1071 | */ |