Skip to content

Commit 791875d

Browse files
committed
rcu: Eliminate the unused __rcu_is_watching() function
The __rcu_is_watching() function is currently not used, aside from to implement the rcu_is_watching() function. This commit therefore eliminates __rcu_is_watching(), which has the beneficial side-effect of shrinking include/linux/rcupdate.h a bit. Reported-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
1 parent d0df7a3 commit 791875d

4 files changed

Lines changed: 4 additions & 43 deletions

File tree

‎include/linux/rcupdate.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,6 @@ do { \
204204
rcu_note_voluntary_context_switch(current); \
205205
} while (0)
206206

207-
#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
208-
bool __rcu_is_watching(void);
209-
#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
210-
211207
/*
212208
* Infrastructure to implement the synchronize_() primitives in
213209
* TREE_RCU and rcu_barrier_() primitives in TINY_RCU.

‎include/linux/rcutiny.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,22 +232,11 @@ static inline void rcu_scheduler_starting(void)
232232
}
233233
#endif /* #else #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SRCU) */
234234

235-
#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE)
236-
237-
static inline bool rcu_is_watching(void)
238-
{
239-
return __rcu_is_watching();
240-
}
241-
242-
#else /* defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
243-
244235
static inline bool rcu_is_watching(void)
245236
{
246237
return true;
247238
}
248239

249-
#endif /* #else defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
250-
251240
static inline void rcu_request_urgent_qs_task(struct task_struct *t)
252241
{
253242
}

‎kernel/rcu/tiny.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,6 @@ void rcu_barrier_sched(void)
5959
}
6060
EXPORT_SYMBOL(rcu_barrier_sched);
6161

62-
#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE)
63-
64-
/*
65-
* Test whether RCU thinks that the current CPU is idle.
66-
*/
67-
bool notrace __rcu_is_watching(void)
68-
{
69-
return true;
70-
}
71-
EXPORT_SYMBOL(__rcu_is_watching);
72-
73-
#endif /* defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
74-
7562
/*
7663
* Helper function for rcu_sched_qs() and rcu_bh_qs().
7764
* Also irqs are disabled to avoid confusion due to interrupt handlers

‎kernel/rcu/tree.c‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,31 +1138,20 @@ void rcu_nmi_exit(void)
11381138
rcu_dynticks_eqs_enter();
11391139
}
11401140

1141-
/**
1142-
* __rcu_is_watching - are RCU read-side critical sections safe?
1143-
*
1144-
* Return true if RCU is watching the running CPU, which means that
1145-
* this CPU can safely enter RCU read-side critical sections. Unlike
1146-
* rcu_is_watching(), the caller of __rcu_is_watching() must have at
1147-
* least disabled preemption.
1148-
*/
1149-
bool notrace __rcu_is_watching(void)
1150-
{
1151-
return !rcu_dynticks_curr_cpu_in_eqs();
1152-
}
1153-
11541141
/**
11551142
* rcu_is_watching - see if RCU thinks that the current CPU is idle
11561143
*
1157-
* If the current CPU is in its idle loop and is neither in an interrupt
1144+
* Return true if RCU is watching the running CPU, which means that this
1145+
* CPU can safely enter RCU read-side critical sections. In other words,
1146+
* if the current CPU is in its idle loop and is neither in an interrupt
11581147
* or NMI handler, return true.
11591148
*/
11601149
bool notrace rcu_is_watching(void)
11611150
{
11621151
bool ret;
11631152

11641153
preempt_disable_notrace();
1165-
ret = __rcu_is_watching();
1154+
ret = !rcu_dynticks_curr_cpu_in_eqs();
11661155
preempt_enable_notrace();
11671156
return ret;
11681157
}

0 commit comments

Comments
 (0)