diff options
author | Paul E. McKenney <paul.mckenney@linaro.org> | 2011-06-17 18:53:19 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-09-29 00:38:12 -0400 |
commit | 29c00b4a1d9e277786120032aa8364631820d863 (patch) | |
tree | 23bf0c8cdb5268ef92ef9ed007639705e922b1b0 /kernel/rcu.h | |
parent | 9d68197c05201d8edc70d58bd1d5dad05d8455e8 (diff) |
rcu: Add event-tracing for RCU callback invocation
There was recently some controversy about the overhead of invoking RCU
callbacks. Add TRACE_EVENT()s to obtain fine-grained timings for the
start and stop of a batch of callbacks and also for each callback invoked.
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu.h')
-rw-r--r-- | kernel/rcu.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/kernel/rcu.h b/kernel/rcu.h new file mode 100644 index 000000000000..7bc16436aba0 --- /dev/null +++ b/kernel/rcu.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Read-Copy Update definitions shared among RCU implementations. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | * | ||
18 | * Copyright IBM Corporation, 2011 | ||
19 | * | ||
20 | * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_RCU_H | ||
24 | #define __LINUX_RCU_H | ||
25 | |||
26 | /* | ||
27 | * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally | ||
28 | * by call_rcu() and rcu callback execution, and are therefore not part of the | ||
29 | * RCU API. Leaving in rcupdate.h because they are used by all RCU flavors. | ||
30 | */ | ||
31 | |||
32 | #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD | ||
33 | # define STATE_RCU_HEAD_READY 0 | ||
34 | # define STATE_RCU_HEAD_QUEUED 1 | ||
35 | |||
36 | extern struct debug_obj_descr rcuhead_debug_descr; | ||
37 | |||
38 | static inline void debug_rcu_head_queue(struct rcu_head *head) | ||
39 | { | ||
40 | WARN_ON_ONCE((unsigned long)head & 0x3); | ||
41 | debug_object_activate(head, &rcuhead_debug_descr); | ||
42 | debug_object_active_state(head, &rcuhead_debug_descr, | ||
43 | STATE_RCU_HEAD_READY, | ||
44 | STATE_RCU_HEAD_QUEUED); | ||
45 | } | ||
46 | |||
47 | static inline void debug_rcu_head_unqueue(struct rcu_head *head) | ||
48 | { | ||
49 | debug_object_active_state(head, &rcuhead_debug_descr, | ||
50 | STATE_RCU_HEAD_QUEUED, | ||
51 | STATE_RCU_HEAD_READY); | ||
52 | debug_object_deactivate(head, &rcuhead_debug_descr); | ||
53 | } | ||
54 | #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | ||
55 | static inline void debug_rcu_head_queue(struct rcu_head *head) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | static inline void debug_rcu_head_unqueue(struct rcu_head *head) | ||
60 | { | ||
61 | } | ||
62 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | ||
63 | |||
64 | extern void kfree(const void *); | ||
65 | |||
66 | static inline void __rcu_reclaim(struct rcu_head *head) | ||
67 | { | ||
68 | unsigned long offset = (unsigned long)head->func; | ||
69 | |||
70 | if (__is_kfree_rcu_offset(offset)) { | ||
71 | trace_rcu_invoke_kfree_callback(head, offset); | ||
72 | kfree((void *)head - offset); | ||
73 | } else { | ||
74 | trace_rcu_invoke_callback(head); | ||
75 | head->func(head); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | #endif /* __LINUX_RCU_H */ | ||