diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-07-02 10:08:42 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-07-02 14:39:19 -0400 |
commit | cba6d0d64ee53772b285d0c0c288deefbeaf7775 (patch) | |
tree | b2d3de62d15a77d23708c1af6f188c86f0d87fb9 /include | |
parent | 6887a4131da3adaab011613776d865f4bcfb5678 (diff) |
Revert "rcu: Move PREEMPT_RCU preemption to switch_to() invocation"
This reverts commit 616c310e83b872024271c915c1b9ab505b9efad9.
(Move PREEMPT_RCU preemption to switch_to() invocation).
Testing by Sasha Levin <levinsasha928@gmail.com> showed that this
can result in deadlock due to invoking the scheduler when one of
the runqueue locks is held. Because this commit was simply a
performance optimization, revert it.
Reported-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Sasha Levin <levinsasha928@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/rcupdate.h | 1 | ||||
-rw-r--r-- | include/linux/rcutiny.h | 6 | ||||
-rw-r--r-- | include/linux/sched.h | 10 |
3 files changed, 6 insertions, 11 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 26d1a47591f1..9cac722b169c 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -184,7 +184,6 @@ 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); | ||
188 | extern void rcu_check_callbacks(int cpu, int user); | 187 | extern void rcu_check_callbacks(int cpu, int user); |
189 | struct notifier_block; | 188 | struct notifier_block; |
190 | extern void rcu_idle_enter(void); | 189 | extern void rcu_idle_enter(void); |
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index 854dc4c5c271..4e56a9c69a35 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
@@ -87,6 +87,10 @@ static inline void kfree_call_rcu(struct rcu_head *head, | |||
87 | 87 | ||
88 | #ifdef CONFIG_TINY_RCU | 88 | #ifdef CONFIG_TINY_RCU |
89 | 89 | ||
90 | static inline void rcu_preempt_note_context_switch(void) | ||
91 | { | ||
92 | } | ||
93 | |||
90 | static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) | 94 | static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) |
91 | { | 95 | { |
92 | *delta_jiffies = ULONG_MAX; | 96 | *delta_jiffies = ULONG_MAX; |
@@ -95,6 +99,7 @@ static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) | |||
95 | 99 | ||
96 | #else /* #ifdef CONFIG_TINY_RCU */ | 100 | #else /* #ifdef CONFIG_TINY_RCU */ |
97 | 101 | ||
102 | void rcu_preempt_note_context_switch(void); | ||
98 | int rcu_preempt_needs_cpu(void); | 103 | int rcu_preempt_needs_cpu(void); |
99 | 104 | ||
100 | static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) | 105 | static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) |
@@ -108,6 +113,7 @@ static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) | |||
108 | static inline void rcu_note_context_switch(int cpu) | 113 | static inline void rcu_note_context_switch(int cpu) |
109 | { | 114 | { |
110 | rcu_sched_qs(cpu); | 115 | rcu_sched_qs(cpu); |
116 | rcu_preempt_note_context_switch(); | ||
111 | } | 117 | } |
112 | 118 | ||
113 | /* | 119 | /* |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4059c0f33f07..06a4c5f4f55c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1871,22 +1871,12 @@ static inline void rcu_copy_process(struct task_struct *p) | |||
1871 | INIT_LIST_HEAD(&p->rcu_node_entry); | 1871 | INIT_LIST_HEAD(&p->rcu_node_entry); |
1872 | } | 1872 | } |
1873 | 1873 | ||
1874 | static inline void rcu_switch_from(struct task_struct *prev) | ||
1875 | { | ||
1876 | if (prev->rcu_read_lock_nesting != 0) | ||
1877 | rcu_preempt_note_context_switch(); | ||
1878 | } | ||
1879 | |||
1880 | #else | 1874 | #else |
1881 | 1875 | ||
1882 | static inline void rcu_copy_process(struct task_struct *p) | 1876 | static inline void rcu_copy_process(struct task_struct *p) |
1883 | { | 1877 | { |
1884 | } | 1878 | } |
1885 | 1879 | ||
1886 | static inline void rcu_switch_from(struct task_struct *prev) | ||
1887 | { | ||
1888 | } | ||
1889 | |||
1890 | #endif | 1880 | #endif |
1891 | 1881 | ||
1892 | #ifdef CONFIG_SMP | 1882 | #ifdef CONFIG_SMP |