1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef __LINUX_RCU_H
24#define __LINUX_RCU_H
25
26#include <trace/events/rcu.h>
27#ifdef CONFIG_RCU_TRACE
28#define RCU_TRACE(stmt) stmt
29#else
30#define RCU_TRACE(stmt)
31#endif
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51#define DYNTICK_TASK_NEST_WIDTH 7
52#define DYNTICK_TASK_NEST_VALUE ((LLONG_MAX >> DYNTICK_TASK_NEST_WIDTH) + 1)
53#define DYNTICK_TASK_NEST_MASK (LLONG_MAX - DYNTICK_TASK_NEST_VALUE + 1)
54#define DYNTICK_TASK_FLAG ((DYNTICK_TASK_NEST_VALUE / 8) * 2)
55#define DYNTICK_TASK_MASK ((DYNTICK_TASK_NEST_VALUE / 8) * 3)
56#define DYNTICK_TASK_EXIT_IDLE (DYNTICK_TASK_NEST_VALUE + \
57 DYNTICK_TASK_FLAG)
58
59
60
61
62
63
64
65#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
66# define STATE_RCU_HEAD_READY 0
67# define STATE_RCU_HEAD_QUEUED 1
68
69extern struct debug_obj_descr rcuhead_debug_descr;
70
71static inline int debug_rcu_head_queue(struct rcu_head *head)
72{
73 int r1;
74
75 r1 = debug_object_activate(head, &rcuhead_debug_descr);
76 debug_object_active_state(head, &rcuhead_debug_descr,
77 STATE_RCU_HEAD_READY,
78 STATE_RCU_HEAD_QUEUED);
79 return r1;
80}
81
82static inline void debug_rcu_head_unqueue(struct rcu_head *head)
83{
84 debug_object_active_state(head, &rcuhead_debug_descr,
85 STATE_RCU_HEAD_QUEUED,
86 STATE_RCU_HEAD_READY);
87 debug_object_deactivate(head, &rcuhead_debug_descr);
88}
89#else
90static inline int debug_rcu_head_queue(struct rcu_head *head)
91{
92 return 0;
93}
94
95static inline void debug_rcu_head_unqueue(struct rcu_head *head)
96{
97}
98#endif
99
100void kfree(const void *);
101
102static inline bool __rcu_reclaim(const char *rn, struct rcu_head *head)
103{
104 unsigned long offset = (unsigned long)head->func;
105
106 rcu_lock_acquire(&rcu_callback_map);
107 if (__is_kfree_rcu_offset(offset)) {
108 RCU_TRACE(trace_rcu_invoke_kfree_callback(rn, head, offset));
109 kfree((void *)head - offset);
110 rcu_lock_release(&rcu_callback_map);
111 return 1;
112 } else {
113 RCU_TRACE(trace_rcu_invoke_callback(rn, head));
114 head->func(head);
115 rcu_lock_release(&rcu_callback_map);
116 return 0;
117 }
118}
119
120#ifdef CONFIG_RCU_STALL_COMMON
121
122extern int rcu_cpu_stall_suppress;
123int rcu_jiffies_till_stall_check(void);
124
125#endif
126
127
128
129
130
131
132#define TPS(x) tracepoint_string(x)
133
134#endif
135