0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef __LINUX_TINY_H
0013 #define __LINUX_TINY_H
0014
0015 #include <asm/param.h> /* for HZ */
0016
0017 unsigned long get_state_synchronize_rcu(void);
0018 unsigned long start_poll_synchronize_rcu(void);
0019 bool poll_state_synchronize_rcu(unsigned long oldstate);
0020
0021 static inline void cond_synchronize_rcu(unsigned long oldstate)
0022 {
0023 might_sleep();
0024 }
0025
0026 static inline unsigned long start_poll_synchronize_rcu_expedited(void)
0027 {
0028 return start_poll_synchronize_rcu();
0029 }
0030
0031 static inline void cond_synchronize_rcu_expedited(unsigned long oldstate)
0032 {
0033 cond_synchronize_rcu(oldstate);
0034 }
0035
0036 extern void rcu_barrier(void);
0037
0038 static inline void synchronize_rcu_expedited(void)
0039 {
0040 synchronize_rcu();
0041 }
0042
0043
0044
0045
0046
0047
0048
0049 extern void kvfree(const void *addr);
0050
0051 static inline void __kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
0052 {
0053 if (head) {
0054 call_rcu(head, func);
0055 return;
0056 }
0057
0058
0059 might_sleep();
0060 synchronize_rcu();
0061 kvfree((void *) func);
0062 }
0063
0064 #ifdef CONFIG_KASAN_GENERIC
0065 void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func);
0066 #else
0067 static inline void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
0068 {
0069 __kvfree_call_rcu(head, func);
0070 }
0071 #endif
0072
0073 void rcu_qs(void);
0074
0075 static inline void rcu_softirq_qs(void)
0076 {
0077 rcu_qs();
0078 }
0079
0080 #define rcu_note_context_switch(preempt) \
0081 do { \
0082 rcu_qs(); \
0083 rcu_tasks_qs(current, (preempt)); \
0084 } while (0)
0085
0086 static inline int rcu_needs_cpu(void)
0087 {
0088 return 0;
0089 }
0090
0091
0092
0093
0094
0095 static inline void rcu_virt_note_context_switch(int cpu) { }
0096 static inline void rcu_cpu_stall_reset(void) { }
0097 static inline int rcu_jiffies_till_stall_check(void) { return 21 * HZ; }
0098 static inline void rcu_irq_exit_check_preempt(void) { }
0099 #define rcu_is_idle_cpu(cpu) \
0100 (is_idle_task(current) && !in_nmi() && !in_hardirq() && !in_serving_softirq())
0101 static inline void exit_rcu(void) { }
0102 static inline bool rcu_preempt_need_deferred_qs(struct task_struct *t)
0103 {
0104 return false;
0105 }
0106 static inline void rcu_preempt_deferred_qs(struct task_struct *t) { }
0107 #ifdef CONFIG_SRCU
0108 void rcu_scheduler_starting(void);
0109 #else
0110 static inline void rcu_scheduler_starting(void) { }
0111 #endif
0112 static inline void rcu_end_inkernel_boot(void) { }
0113 static inline bool rcu_inkernel_boot_has_ended(void) { return true; }
0114 static inline bool rcu_is_watching(void) { return true; }
0115 static inline void rcu_momentary_dyntick_idle(void) { }
0116 static inline void kfree_rcu_scheduler_running(void) { }
0117 static inline bool rcu_gp_might_be_stalled(void) { return false; }
0118
0119
0120 static inline void rcu_all_qs(void) { barrier(); }
0121
0122
0123 #define rcutree_prepare_cpu NULL
0124 #define rcutree_online_cpu NULL
0125 #define rcutree_offline_cpu NULL
0126 #define rcutree_dead_cpu NULL
0127 #define rcutree_dying_cpu NULL
0128 static inline void rcu_cpu_starting(unsigned int cpu) { }
0129
0130 #endif