summaryrefslogtreecommitdiffstats
path: root/include/linux/rcupdate.h
diff options
context:
space:
mode:
authorBoqun Feng <boqun.feng@gmail.com>2016-03-23 11:11:48 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2016-03-31 16:34:50 -0400
commit293e2421fe25839500207eda123cc4475f8d17b8 (patch)
treeca4768d1bc3b351394a2a3003c7cc98db923197a /include/linux/rcupdate.h
parent8c7c4829a81c1838f18c12ce5a3a5c29a08bf0a8 (diff)
rcu: Remove superfluous versions of rcu_read_lock_sched_held()
Currently, we have four versions of rcu_read_lock_sched_held(), depending on the combined choices on PREEMPT_COUNT and DEBUG_LOCK_ALLOC. However, there is an existing function preemptible() that already distinguishes between the PREEMPT_COUNT=y and PREEMPT_COUNT=n cases, and allows these four implementations to be consolidated down to two. This commit therefore uses preemptible() to achieve this consolidation. Note that there could be a small performance regression in the case of CONFIG_DEBUG_LOCK_ALLOC=y && PREEMPT_COUNT=n. However, given the overhead associated with CONFIG_DEBUG_LOCK_ALLOC=y, this should be down in the noise. Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r--include/linux/rcupdate.h17
1 files changed, 1 insertions, 16 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 45de591657a6..5f1533e3d032 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -508,14 +508,7 @@ int rcu_read_lock_bh_held(void);
508 * CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side 508 * CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side
509 * critical section unless it can prove otherwise. 509 * critical section unless it can prove otherwise.
510 */ 510 */
511#ifdef CONFIG_PREEMPT_COUNT
512int rcu_read_lock_sched_held(void); 511int rcu_read_lock_sched_held(void);
513#else /* #ifdef CONFIG_PREEMPT_COUNT */
514static inline int rcu_read_lock_sched_held(void)
515{
516 return 1;
517}
518#endif /* #else #ifdef CONFIG_PREEMPT_COUNT */
519 512
520#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 513#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
521 514
@@ -532,18 +525,10 @@ static inline int rcu_read_lock_bh_held(void)
532 return 1; 525 return 1;
533} 526}
534 527
535#ifdef CONFIG_PREEMPT_COUNT
536static inline int rcu_read_lock_sched_held(void) 528static inline int rcu_read_lock_sched_held(void)
537{ 529{
538 return preempt_count() != 0 || irqs_disabled(); 530 return !preemptible();
539} 531}
540#else /* #ifdef CONFIG_PREEMPT_COUNT */
541static inline int rcu_read_lock_sched_held(void)
542{
543 return 1;
544}
545#endif /* #else #ifdef CONFIG_PREEMPT_COUNT */
546
547#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 532#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
548 533
549#ifdef CONFIG_PROVE_RCU 534#ifdef CONFIG_PROVE_RCU