Skip to contentSkip to conversation

rcu: Fix incorrect judgment condition in show_rcu_nocb_state()

PATCH In review Zqiang 2 participants 3 messages May 25, 2022 – May 31, 2022 RCU

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH 1/1 rcu: Fix incorrect judgment condition in show_rcu_nocb_state()

When check the 'rdp->nocb_cb_kthread' tasks exists, if is true, however the output is the cpu where 'rdp->nocb_gp_kthread' is located. this ensure that the tasks in the judgment condition and the tasks of the cpu where the output tasks are located are the same tasks.

---
 kernel/rcu/tree_nocb.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/tree_nocb.h +3 -3
index fa8e4f82e60c..f4ee81d119c8 100644
@@ -1438,8 +1438,8 @@ static void show_rcu_nocb_gp_state(struct rcu_data *rdp)
 		(long)rdp->nocb_gp_seq,
 		rnp->grplo, rnp->grphi, READ_ONCE(rdp->nocb_gp_loops),
 		rdp->nocb_gp_kthread ? task_state_to_char(rdp->nocb_gp_kthread) : '.',
-		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
-		show_rcu_should_be_on_cpu(rdp->nocb_cb_kthread));
+		rdp->nocb_gp_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
+		show_rcu_should_be_on_cpu(rdp->nocb_gp_kthread));
 }
 
 /* Dump out nocb kthread state for the specified rcu_data structure. */
@@ -1483,7 +1483,7 @@ static void show_rcu_nocb_state(struct rcu_data *rdp)
 		".B"[!!rcu_cblist_n_cbs(&rdp->nocb_bypass)],
 		rcu_segcblist_n_cbs(&rdp->cblist),
 		rdp->nocb_cb_kthread ? task_state_to_char(rdp->nocb_cb_kthread) : '.',
-		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
+		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_cb_kthread) : -1,
 		show_rcu_should_be_on_cpu(rdp->nocb_cb_kthread));
 
 	/* It is OK for GP kthreads to have GP state. */
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Zqiang

When check the 'rdp->nocb_cb_kthread' tasks exists, if is true, however the output is the cpu where 'rdp->nocb_gp_kthread' is located. this ensure that the tasks in the judgment condition and the tasks of the cpu where the output tasks are located are the same tasks.

---
  kernel/rcu/tree_nocb.h | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/tree_nocb.h +2 -2
index fa8e4f82e60c..f4ee81d119c8 100644
@@ -1438,8 +1438,8 @@ static void show_rcu_nocb_gp_state(struct rcu_data *rdp)
  		(long)rdp->nocb_gp_seq,
  		rnp->grplo, rnp->grphi, READ_ONCE(rdp->nocb_gp_loops),
  		rdp->nocb_gp_kthread ? task_state_to_char(rdp->nocb_gp_kthread) : '.',
-		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
-		show_rcu_should_be_on_cpu(rdp->nocb_cb_kthread));
+		rdp->nocb_gp_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
+		show_rcu_should_be_on_cpu(rdp->nocb_gp_kthread));
  }
 
  /* Dump out nocb kthread state for the specified rcu_data structure. */

kernel/rcu/tree_nocb.h static void show_rcu_nocb_state(struct rcu_data *rdp) · line 1488

Quoted 7 lines
kernel/rcu/tree_nocb.h +1 -1
@@ -1483,7 +1483,7 @@ static void show_rcu_nocb_state(struct rcu_data *rdp)
  		".B"[!!rcu_cblist_n_cbs(&rdp->nocb_bypass)],
  		rcu_segcblist_n_cbs(&rdp->cblist),
  		rdp->nocb_cb_kthread ? task_state_to_char(rdp->nocb_cb_kthread) : '.',
-		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
+		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_cb_kthread) : -1,
  		show_rcu_should_be_on_cpu(rdp->nocb_cb_kthread));
 

Nice !!

Reviewed-by [email protected]

-Mukesh

Quoted 1 line
kernel/rcu/tree_nocb.h +0 -0
  	/* It is OK for GP kthreads to have GP state. */
#2 lore raw
In reply to Zqiang

Hi Frederic

Friendly ping.

Thanks
Zqiang

When check the 'rdp->nocb_cb_kthread' tasks exists, if is true, however the output is the cpu where 'rdp->nocb_gp_kthread' is located. this ensure that the tasks in the judgment condition and the tasks of the cpu where the output tasks are located are the same tasks.

---
 kernel/rcu/tree_nocb.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/tree_nocb.h +3 -3
index fa8e4f82e60c..f4ee81d119c8 100644
@@ -1438,8 +1438,8 @@ static void show_rcu_nocb_gp_state(struct rcu_data *rdp)
 		(long)rdp->nocb_gp_seq,
 		rnp->grplo, rnp->grphi, READ_ONCE(rdp->nocb_gp_loops),
 		rdp->nocb_gp_kthread ? task_state_to_char(rdp->nocb_gp_kthread) : '.',
-		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
-		show_rcu_should_be_on_cpu(rdp->nocb_cb_kthread));
+		rdp->nocb_gp_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
+		show_rcu_should_be_on_cpu(rdp->nocb_gp_kthread));
 }
 
 /* Dump out nocb kthread state for the specified rcu_data structure. */
@@ -1483,7 +1483,7 @@ static void show_rcu_nocb_state(struct rcu_data *rdp)
 		".B"[!!rcu_cblist_n_cbs(&rdp->nocb_bypass)],
 		rcu_segcblist_n_cbs(&rdp->cblist),
 		rdp->nocb_cb_kthread ? task_state_to_char(rdp->nocb_cb_kthread) : '.',
-		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
+		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_cb_kthread) : -1,
 		show_rcu_should_be_on_cpu(rdp->nocb_cb_kthread));
 
 	/* It is OK for GP kthreads to have GP state. */
Signature · 1 line
2.25.1