linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcu: Fix incorrect judgment condition in show_rcu_nocb_state()
@ 2022-05-25  3:34 Zqiang
  2022-05-25 11:56 ` Mukesh Ojha
  2022-05-31 11:24 ` Zhang, Qiang1
  0 siblings, 2 replies; 3+ messages in thread
From: Zqiang @ 2022-05-25  3:34 UTC (permalink / raw)
  To: paulmck, frederic; +Cc: rcu, linux-kernel

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.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tree_nocb.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
index fa8e4f82e60c..f4ee81d119c8 100644
--- a/kernel/rcu/tree_nocb.h
+++ b/kernel/rcu/tree_nocb.h
@@ -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. */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rcu: Fix incorrect judgment condition in show_rcu_nocb_state()
  2022-05-25  3:34 [PATCH] rcu: Fix incorrect judgment condition in show_rcu_nocb_state() Zqiang
@ 2022-05-25 11:56 ` Mukesh Ojha
  2022-05-31 11:24 ` Zhang, Qiang1
  1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2022-05-25 11:56 UTC (permalink / raw)
  To: Zqiang, paulmck, frederic; +Cc: rcu, linux-kernel



On 5/25/2022 9:04 AM, Zqiang wrote:
> 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.
> 
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
>   kernel/rcu/tree_nocb.h | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
> index fa8e4f82e60c..f4ee81d119c8 100644
> --- a/kernel/rcu/tree_nocb.h
> +++ b/kernel/rcu/tree_nocb.h
> @@ -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));
>   

Nice !!
Reviewed-by: quic_mojha@quicinc.com

-Mukesh

>   	/* It is OK for GP kthreads to have GP state. */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] rcu: Fix incorrect judgment condition in show_rcu_nocb_state()
  2022-05-25  3:34 [PATCH] rcu: Fix incorrect judgment condition in show_rcu_nocb_state() Zqiang
  2022-05-25 11:56 ` Mukesh Ojha
@ 2022-05-31 11:24 ` Zhang, Qiang1
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Qiang1 @ 2022-05-31 11:24 UTC (permalink / raw)
  To: Zhang, Qiang1, paulmck, frederic; +Cc: rcu, linux-kernel

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.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tree_nocb.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
index fa8e4f82e60c..f4ee81d119c8 100644
--- a/kernel/rcu/tree_nocb.h
+++ b/kernel/rcu/tree_nocb.h
@@ -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. */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-31 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25  3:34 [PATCH] rcu: Fix incorrect judgment condition in show_rcu_nocb_state() Zqiang
2022-05-25 11:56 ` Mukesh Ojha
2022-05-31 11:24 ` Zhang, Qiang1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).