[PATCH tip/core/rcu 1/3] rcu: Make rcu_read_lock_sched_held() handle !PREEMPT

From: Paul E. McKenney
Date: Wed Mar 03 2010 - 20:50:50 EST


The rcu_read_lock_sched_held() needs to unconditionally return the value
"1" in a !PREEMPT kernel, because under !PREEMPT, -all- kernel code is
implicitly preempt-disabled. This patch makes this happen.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
---
include/linux/rcupdate.h | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index fb80ce3..e0da43e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -147,6 +147,7 @@ static inline int rcu_read_lock_bh_held(void)
*
* Check rcu_scheduler_active to prevent false positives during boot.
*/
+#ifdef CONFIG_PREEMPT
static inline int rcu_read_lock_sched_held(void)
{
int lockdep_opinion = 0;
@@ -157,6 +158,12 @@ static inline int rcu_read_lock_sched_held(void)
lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
return lockdep_opinion || preempt_count() != 0;
}
+#else /* #ifdef CONFIG_PREEMPT */
+static inline int rcu_read_lock_sched_held(void)
+{
+ return 1;
+}
+#endif /* #else #ifdef CONFIG_PREEMPT */

#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */

@@ -181,10 +188,17 @@ static inline int rcu_read_lock_bh_held(void)
return 1;
}

+#ifdef CONFIG_PREEMPT
static inline int rcu_read_lock_sched_held(void)
{
return !rcu_scheduler_active || preempt_count() != 0;
}
+#else /* #ifdef CONFIG_PREEMPT */
+static inline int rcu_read_lock_sched_held(void)
+{
+ return 1;
+}
+#endif /* #else #ifdef CONFIG_PREEMPT */

#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */

--
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/