mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V2] rcu/torture replace wait_event with wait_event_idle
@ 2023-05-02  0:01 zhouzhouyi
  2023-05-02 13:40 ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: zhouzhouyi @ 2023-05-02  0:01 UTC (permalink / raw)
  To: paulmck, rcu, linux-kernel, lance; +Cc: Zhouyi Zhou

From: Zhouyi Zhou <zhouzhouyi@gmail.com>

In kfree_rcu_test, kfree_scale_shutdown will be detected as hung task
if kfree_loops is too big. Replace wait_event with wait_event_idle
to avoid false positive.

Tested in the PPC VM of Open Source Lab of Oregon State University.

Suggested-by: Paul E. McKenney <paulmck@kernel.org>    
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>                    
---
 kernel/rcu/rcuscale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index 91fb5905a008..d99c586939d1 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -771,7 +771,7 @@ kfree_scale_cleanup(void)
 static int
 kfree_scale_shutdown(void *arg)
 {
-	wait_event(shutdown_wq,
+	wait_event_idle(shutdown_wq,
 		   atomic_read(&n_kfree_scale_thread_ended) >= kfree_nrealthreads);
 
 	smp_mb(); /* Wake before output. */
-- 
2.34.1


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

* Re: [PATCH V2] rcu/torture replace wait_event with wait_event_idle
  2023-05-02  0:01 [PATCH V2] rcu/torture replace wait_event with wait_event_idle zhouzhouyi
@ 2023-05-02 13:40 ` Paul E. McKenney
  2023-05-02 13:50   ` Zhouyi Zhou
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2023-05-02 13:40 UTC (permalink / raw)
  To: zhouzhouyi; +Cc: rcu, linux-kernel, lance

On Tue, May 02, 2023 at 08:01:41AM +0800, zhouzhouyi@gmail.com wrote:
> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> 
> In kfree_rcu_test, kfree_scale_shutdown will be detected as hung task
> if kfree_loops is too big. Replace wait_event with wait_event_idle
> to avoid false positive.
> 
> Tested in the PPC VM of Open Source Lab of Oregon State University.
> 
> Suggested-by: Paul E. McKenney <paulmck@kernel.org>    
> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>                    

Good catch, thank you!

However, this commit beat you to it:

ef1ef3d47677 ("rcuscale: Move shutdown from wait_event() to wait_event_idle()")

							Thanx, Paul

> ---
>  kernel/rcu/rcuscale.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
> index 91fb5905a008..d99c586939d1 100644
> --- a/kernel/rcu/rcuscale.c
> +++ b/kernel/rcu/rcuscale.c
> @@ -771,7 +771,7 @@ kfree_scale_cleanup(void)
>  static int
>  kfree_scale_shutdown(void *arg)
>  {
> -	wait_event(shutdown_wq,
> +	wait_event_idle(shutdown_wq,
>  		   atomic_read(&n_kfree_scale_thread_ended) >= kfree_nrealthreads);
>  
>  	smp_mb(); /* Wake before output. */
> -- 
> 2.34.1
> 

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

* Re: [PATCH V2] rcu/torture replace wait_event with wait_event_idle
  2023-05-02 13:40 ` Paul E. McKenney
@ 2023-05-02 13:50   ` Zhouyi Zhou
  0 siblings, 0 replies; 3+ messages in thread
From: Zhouyi Zhou @ 2023-05-02 13:50 UTC (permalink / raw)
  To: paulmck; +Cc: rcu, linux-kernel, lance

On Tue, May 2, 2023 at 9:40 PM Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Tue, May 02, 2023 at 08:01:41AM +0800, zhouzhouyi@gmail.com wrote:
> > From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> >
> > In kfree_rcu_test, kfree_scale_shutdown will be detected as hung task
> > if kfree_loops is too big. Replace wait_event with wait_event_idle
> > to avoid false positive.
> >
> > Tested in the PPC VM of Open Source Lab of Oregon State University.
> >
> > Suggested-by: Paul E. McKenney <paulmck@kernel.org>
> > Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
>
> Good catch, thank you!
>
> However, this commit beat you to it:
>
> ef1ef3d47677 ("rcuscale: Move shutdown from wait_event() to wait_event_idle()")
You are very welcome ;-) Still, this is a very fruitful learning
process for me ;-)

Cheers
Zhouyi
>
>                                                         Thanx, Paul
>
> > ---
> >  kernel/rcu/rcuscale.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
> > index 91fb5905a008..d99c586939d1 100644
> > --- a/kernel/rcu/rcuscale.c
> > +++ b/kernel/rcu/rcuscale.c
> > @@ -771,7 +771,7 @@ kfree_scale_cleanup(void)
> >  static int
> >  kfree_scale_shutdown(void *arg)
> >  {
> > -     wait_event(shutdown_wq,
> > +     wait_event_idle(shutdown_wq,
> >                  atomic_read(&n_kfree_scale_thread_ended) >= kfree_nrealthreads);
> >
> >       smp_mb(); /* Wake before output. */
> > --
> > 2.34.1
> >

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

end of thread, other threads:[~2023-05-02 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02  0:01 [PATCH V2] rcu/torture replace wait_event with wait_event_idle zhouzhouyi
2023-05-02 13:40 ` Paul E. McKenney
2023-05-02 13:50   ` Zhouyi Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®