Skip to contentSkip to conversation

RCU: Adjust the comment of function rcu_is_watching

PATCH In review [email protected] 2 participants 2 messages Oct 8, 2018 – Oct 9, 2018 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RCU: Adjust the comment of function rcu_is_watching

From: Zhouyi Zhou <[email protected]>

Because RCU avoids interrupting idle CPUs, rcu_is_watching is used to test whether or not it is currently legal to run RCU read-side critical sections on this CPU.

First sentence and last sentence of current comment for rcu_is_watching have opposite meaning of what is expected.

---
 kernel/rcu/tree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/tree.c +3 -3
index 0b760c1..adb04ea 100644
@@ -1010,12 +1010,12 @@ void rcu_irq_enter_irqson(void)
 }
 
 /**
- * rcu_is_watching - see if RCU thinks that the current CPU is idle
+ * rcu_is_watching - see if RCU thinks that the current CPU is not idle
  *
  * Return true if RCU is watching the running CPU, which means that this
  * CPU can safely enter RCU read-side critical sections.  In other words,
- * if the current CPU is in its idle loop and is neither in an interrupt
- * or NMI handler, return true.
+ * if the current CPU is not in its idle loop or is in an interrupt or
+ * NMI handler, return true.
  */
 bool notrace rcu_is_watching(void)
 {
Signature · 1 line
2.1.4
#1 lore raw
Quoted 10 lines · On Mon, Oct 08, 2018 at 06:50:41AM +0000, [email protected] wrote:

From: Zhouyi Zhou <[email protected]>

Because RCU avoids interrupting idle CPUs, rcu_is_watching is used to test whether or not it is currently legal to run RCU read-side critical sections on this CPU.

First sentence and last sentence of current comment for rcu_is_watching have opposite meaning of what is expected.

Good eyes! Applied and pushed, thank you!

Thanx, Paul

Quoted 27 lines
---
 kernel/rcu/tree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/tree.c +3 -3
index 0b760c1..adb04ea 100644
@@ -1010,12 +1010,12 @@ void rcu_irq_enter_irqson(void)
 }
 
 /**
- * rcu_is_watching - see if RCU thinks that the current CPU is idle
+ * rcu_is_watching - see if RCU thinks that the current CPU is not idle
  *
  * Return true if RCU is watching the running CPU, which means that this
  * CPU can safely enter RCU read-side critical sections.  In other words,
- * if the current CPU is in its idle loop and is neither in an interrupt
- * or NMI handler, return true.
+ * if the current CPU is not in its idle loop or is in an interrupt or
+ * NMI handler, return true.
  */
 bool notrace rcu_is_watching(void)
 {
Signature · 1 line
2.1.4