diff options
author | Paul E. McKenney <paul.mckenney@linaro.org> | 2011-06-21 03:13:44 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-09-29 00:38:14 -0400 |
commit | e99033c5c160f1f247c665923a66acec693a967c (patch) | |
tree | c5b0863ad4b673134070872a159055237186f0fe | |
parent | 300df91ca9358f7f09298eec9503c12b32054ef7 (diff) |
rcu: Put names into TINY_RCU structures under RCU_TRACE
In order to allow event tracing to distinguish between flavors of
RCU, we need those names in the relevant RCU data structures. TINY_RCU
has avoided them for memory-footprint reasons, so add them only if
CONFIG_RCU_TRACE=y.
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r-- | kernel/rcu.h | 10 | ||||
-rw-r--r-- | kernel/rcutiny.c | 13 | ||||
-rw-r--r-- | kernel/rcutiny_plugin.h | 10 | ||||
-rw-r--r-- | kernel/rcutree.c | 10 | ||||
-rw-r--r-- | kernel/rcutree_plugin.h | 2 |
5 files changed, 18 insertions, 27 deletions
diff --git a/kernel/rcu.h b/kernel/rcu.h index 7bc16436aba0..d7f00ec8b47b 100644 --- a/kernel/rcu.h +++ b/kernel/rcu.h | |||
@@ -23,6 +23,12 @@ | |||
23 | #ifndef __LINUX_RCU_H | 23 | #ifndef __LINUX_RCU_H |
24 | #define __LINUX_RCU_H | 24 | #define __LINUX_RCU_H |
25 | 25 | ||
26 | #ifdef CONFIG_RCU_TRACE | ||
27 | #define RCU_TRACE(stmt) stmt | ||
28 | #else /* #ifdef CONFIG_RCU_TRACE */ | ||
29 | #define RCU_TRACE(stmt) | ||
30 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ | ||
31 | |||
26 | /* | 32 | /* |
27 | * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally | 33 | * 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 | 34 | * by call_rcu() and rcu callback execution, and are therefore not part of the |
@@ -68,10 +74,10 @@ static inline void __rcu_reclaim(struct rcu_head *head) | |||
68 | unsigned long offset = (unsigned long)head->func; | 74 | unsigned long offset = (unsigned long)head->func; |
69 | 75 | ||
70 | if (__is_kfree_rcu_offset(offset)) { | 76 | if (__is_kfree_rcu_offset(offset)) { |
71 | trace_rcu_invoke_kfree_callback(head, offset); | 77 | RCU_TRACE(trace_rcu_invoke_kfree_callback(head, offset)); |
72 | kfree((void *)head - offset); | 78 | kfree((void *)head - offset); |
73 | } else { | 79 | } else { |
74 | trace_rcu_invoke_callback(head); | 80 | RCU_TRACE(trace_rcu_invoke_callback(head)); |
75 | head->func(head); | 81 | head->func(head); |
76 | } | 82 | } |
77 | } | 83 | } |
diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c index 19453ba1392e..0d28974b78f4 100644 --- a/kernel/rcutiny.c +++ b/kernel/rcutiny.c | |||
@@ -38,20 +38,7 @@ | |||
38 | #include <linux/prefetch.h> | 38 | #include <linux/prefetch.h> |
39 | 39 | ||
40 | #ifdef CONFIG_RCU_TRACE | 40 | #ifdef CONFIG_RCU_TRACE |
41 | |||
42 | #include <trace/events/rcu.h> | 41 | #include <trace/events/rcu.h> |
43 | |||
44 | #else /* #ifdef CONFIG_RCU_TRACE */ | ||
45 | |||
46 | /* No by-default tracing in TINY_RCU: Keep TINY_RCU tiny! */ | ||
47 | static void trace_rcu_invoke_kfree_callback(struct rcu_head *rhp, | ||
48 | unsigned long offset) | ||
49 | { | ||
50 | } | ||
51 | static void trace_rcu_invoke_callback(struct rcu_head *head) | ||
52 | { | ||
53 | } | ||
54 | |||
55 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ | 42 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ |
56 | 43 | ||
57 | #include "rcu.h" | 44 | #include "rcu.h" |
diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h index 6b0cedb383e0..791ddf7c99ab 100644 --- a/kernel/rcutiny_plugin.h +++ b/kernel/rcutiny_plugin.h | |||
@@ -26,29 +26,26 @@ | |||
26 | #include <linux/debugfs.h> | 26 | #include <linux/debugfs.h> |
27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
28 | 28 | ||
29 | #ifdef CONFIG_RCU_TRACE | ||
30 | #define RCU_TRACE(stmt) stmt | ||
31 | #else /* #ifdef CONFIG_RCU_TRACE */ | ||
32 | #define RCU_TRACE(stmt) | ||
33 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ | ||
34 | |||
35 | /* Global control variables for rcupdate callback mechanism. */ | 29 | /* Global control variables for rcupdate callback mechanism. */ |
36 | struct rcu_ctrlblk { | 30 | struct rcu_ctrlblk { |
37 | struct rcu_head *rcucblist; /* List of pending callbacks (CBs). */ | 31 | struct rcu_head *rcucblist; /* List of pending callbacks (CBs). */ |
38 | struct rcu_head **donetail; /* ->next pointer of last "done" CB. */ | 32 | struct rcu_head **donetail; /* ->next pointer of last "done" CB. */ |
39 | struct rcu_head **curtail; /* ->next pointer of last CB. */ | 33 | struct rcu_head **curtail; /* ->next pointer of last CB. */ |
40 | RCU_TRACE(long qlen); /* Number of pending CBs. */ | 34 | RCU_TRACE(long qlen); /* Number of pending CBs. */ |
35 | RCU_TRACE(char *name); /* Name of RCU type. */ | ||
41 | }; | 36 | }; |
42 | 37 | ||
43 | /* Definition for rcupdate control block. */ | 38 | /* Definition for rcupdate control block. */ |
44 | static struct rcu_ctrlblk rcu_sched_ctrlblk = { | 39 | static struct rcu_ctrlblk rcu_sched_ctrlblk = { |
45 | .donetail = &rcu_sched_ctrlblk.rcucblist, | 40 | .donetail = &rcu_sched_ctrlblk.rcucblist, |
46 | .curtail = &rcu_sched_ctrlblk.rcucblist, | 41 | .curtail = &rcu_sched_ctrlblk.rcucblist, |
42 | RCU_TRACE(.name = "rcu_sched") | ||
47 | }; | 43 | }; |
48 | 44 | ||
49 | static struct rcu_ctrlblk rcu_bh_ctrlblk = { | 45 | static struct rcu_ctrlblk rcu_bh_ctrlblk = { |
50 | .donetail = &rcu_bh_ctrlblk.rcucblist, | 46 | .donetail = &rcu_bh_ctrlblk.rcucblist, |
51 | .curtail = &rcu_bh_ctrlblk.rcucblist, | 47 | .curtail = &rcu_bh_ctrlblk.rcucblist, |
48 | RCU_TRACE(.name = "rcu_bh") | ||
52 | }; | 49 | }; |
53 | 50 | ||
54 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 51 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
@@ -131,6 +128,7 @@ static struct rcu_preempt_ctrlblk rcu_preempt_ctrlblk = { | |||
131 | .rcb.curtail = &rcu_preempt_ctrlblk.rcb.rcucblist, | 128 | .rcb.curtail = &rcu_preempt_ctrlblk.rcb.rcucblist, |
132 | .nexttail = &rcu_preempt_ctrlblk.rcb.rcucblist, | 129 | .nexttail = &rcu_preempt_ctrlblk.rcb.rcucblist, |
133 | .blkd_tasks = LIST_HEAD_INIT(rcu_preempt_ctrlblk.blkd_tasks), | 130 | .blkd_tasks = LIST_HEAD_INIT(rcu_preempt_ctrlblk.blkd_tasks), |
131 | RCU_TRACE(.rcb.name = "rcu_preempt") | ||
134 | }; | 132 | }; |
135 | 133 | ||
136 | static int rcu_preempted_readers_exp(void); | 134 | static int rcu_preempted_readers_exp(void); |
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 2a9643bd6ae9..b953e2c72e25 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -61,7 +61,7 @@ | |||
61 | static struct lock_class_key rcu_node_class[NUM_RCU_LVLS]; | 61 | static struct lock_class_key rcu_node_class[NUM_RCU_LVLS]; |
62 | 62 | ||
63 | #define RCU_STATE_INITIALIZER(structname) { \ | 63 | #define RCU_STATE_INITIALIZER(structname) { \ |
64 | .level = { &structname.node[0] }, \ | 64 | .level = { &structname##_state.node[0] }, \ |
65 | .levelcnt = { \ | 65 | .levelcnt = { \ |
66 | NUM_RCU_LVL_0, /* root of hierarchy. */ \ | 66 | NUM_RCU_LVL_0, /* root of hierarchy. */ \ |
67 | NUM_RCU_LVL_1, \ | 67 | NUM_RCU_LVL_1, \ |
@@ -72,17 +72,17 @@ static struct lock_class_key rcu_node_class[NUM_RCU_LVLS]; | |||
72 | .signaled = RCU_GP_IDLE, \ | 72 | .signaled = RCU_GP_IDLE, \ |
73 | .gpnum = -300, \ | 73 | .gpnum = -300, \ |
74 | .completed = -300, \ | 74 | .completed = -300, \ |
75 | .onofflock = __RAW_SPIN_LOCK_UNLOCKED(&structname.onofflock), \ | 75 | .onofflock = __RAW_SPIN_LOCK_UNLOCKED(&structname##_state.onofflock), \ |
76 | .fqslock = __RAW_SPIN_LOCK_UNLOCKED(&structname.fqslock), \ | 76 | .fqslock = __RAW_SPIN_LOCK_UNLOCKED(&structname##_state.fqslock), \ |
77 | .n_force_qs = 0, \ | 77 | .n_force_qs = 0, \ |
78 | .n_force_qs_ngp = 0, \ | 78 | .n_force_qs_ngp = 0, \ |
79 | .name = #structname, \ | 79 | .name = #structname, \ |
80 | } | 80 | } |
81 | 81 | ||
82 | struct rcu_state rcu_sched_state = RCU_STATE_INITIALIZER(rcu_sched_state); | 82 | struct rcu_state rcu_sched_state = RCU_STATE_INITIALIZER(rcu_sched); |
83 | DEFINE_PER_CPU(struct rcu_data, rcu_sched_data); | 83 | DEFINE_PER_CPU(struct rcu_data, rcu_sched_data); |
84 | 84 | ||
85 | struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state); | 85 | struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh); |
86 | DEFINE_PER_CPU(struct rcu_data, rcu_bh_data); | 86 | DEFINE_PER_CPU(struct rcu_data, rcu_bh_data); |
87 | 87 | ||
88 | static struct rcu_state *rcu_state; | 88 | static struct rcu_state *rcu_state; |
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h index 43daa46bc6f2..a90bf3c17492 100644 --- a/kernel/rcutree_plugin.h +++ b/kernel/rcutree_plugin.h | |||
@@ -64,7 +64,7 @@ static void __init rcu_bootup_announce_oddness(void) | |||
64 | 64 | ||
65 | #ifdef CONFIG_TREE_PREEMPT_RCU | 65 | #ifdef CONFIG_TREE_PREEMPT_RCU |
66 | 66 | ||
67 | struct rcu_state rcu_preempt_state = RCU_STATE_INITIALIZER(rcu_preempt_state); | 67 | struct rcu_state rcu_preempt_state = RCU_STATE_INITIALIZER(rcu_preempt); |
68 | DEFINE_PER_CPU(struct rcu_data, rcu_preempt_data); | 68 | DEFINE_PER_CPU(struct rcu_data, rcu_preempt_data); |
69 | static struct rcu_state *rcu_state = &rcu_preempt_state; | 69 | static struct rcu_state *rcu_state = &rcu_preempt_state; |
70 | 70 | ||