diff options
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r-- | include/linux/rcupdate.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 20fb776a1d4a..26d1a47591f1 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -184,12 +184,14 @@ static inline int rcu_preempt_depth(void) | |||
184 | /* Internal to kernel */ | 184 | /* Internal to kernel */ |
185 | extern void rcu_sched_qs(int cpu); | 185 | extern void rcu_sched_qs(int cpu); |
186 | extern void rcu_bh_qs(int cpu); | 186 | extern void rcu_bh_qs(int cpu); |
187 | extern void rcu_preempt_note_context_switch(void); | ||
187 | extern void rcu_check_callbacks(int cpu, int user); | 188 | extern void rcu_check_callbacks(int cpu, int user); |
188 | struct notifier_block; | 189 | struct notifier_block; |
189 | extern void rcu_idle_enter(void); | 190 | extern void rcu_idle_enter(void); |
190 | extern void rcu_idle_exit(void); | 191 | extern void rcu_idle_exit(void); |
191 | extern void rcu_irq_enter(void); | 192 | extern void rcu_irq_enter(void); |
192 | extern void rcu_irq_exit(void); | 193 | extern void rcu_irq_exit(void); |
194 | extern void exit_rcu(void); | ||
193 | 195 | ||
194 | /** | 196 | /** |
195 | * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers | 197 | * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers |
@@ -922,6 +924,21 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset) | |||
922 | kfree_call_rcu(head, (rcu_callback)offset); | 924 | kfree_call_rcu(head, (rcu_callback)offset); |
923 | } | 925 | } |
924 | 926 | ||
927 | /* | ||
928 | * Does the specified offset indicate that the corresponding rcu_head | ||
929 | * structure can be handled by kfree_rcu()? | ||
930 | */ | ||
931 | #define __is_kfree_rcu_offset(offset) ((offset) < 4096) | ||
932 | |||
933 | /* | ||
934 | * Helper macro for kfree_rcu() to prevent argument-expansion eyestrain. | ||
935 | */ | ||
936 | #define __kfree_rcu(head, offset) \ | ||
937 | do { \ | ||
938 | BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \ | ||
939 | call_rcu(head, (void (*)(struct rcu_head *))(unsigned long)(offset)); \ | ||
940 | } while (0) | ||
941 | |||
925 | /** | 942 | /** |
926 | * kfree_rcu() - kfree an object after a grace period. | 943 | * kfree_rcu() - kfree an object after a grace period. |
927 | * @ptr: pointer to kfree | 944 | * @ptr: pointer to kfree |
@@ -944,6 +961,9 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset) | |||
944 | * | 961 | * |
945 | * Note that the allowable offset might decrease in the future, for example, | 962 | * Note that the allowable offset might decrease in the future, for example, |
946 | * to allow something like kmem_cache_free_rcu(). | 963 | * to allow something like kmem_cache_free_rcu(). |
964 | * | ||
965 | * The BUILD_BUG_ON check must not involve any function calls, hence the | ||
966 | * checks are done in macros here. | ||
947 | */ | 967 | */ |
948 | #define kfree_rcu(ptr, rcu_head) \ | 968 | #define kfree_rcu(ptr, rcu_head) \ |
949 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) | 969 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) |