linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] rcu: Remove unnecessary updates to ret in rcu_gp_fqs_loop
       [not found] <20210629135551.4080-1-fishland@aliyun.com>
@ 2021-06-29 17:44 ` Paul E. McKenney
       [not found]   ` <202106301122531910761@zte.com.cn>
  0 siblings, 1 reply; 2+ messages in thread
From: Paul E. McKenney @ 2021-06-29 17:44 UTC (permalink / raw)
  To: Liu Song; +Cc: liu.song11, linux-kernel

On Tue, Jun 29, 2021 at 09:55:51PM +0800, Liu Song wrote:
> From: Liu Song <liu.song11@zte.com.cn>
> 
> The ret value will be updated in the subsequent process,
> so there is no need to update it here.
> 
> Signed-off-by: Liu Song <liu.song11@zte.com.cn>

Good eyes, and it is safe to say that rcutorture would never have found
that one.  ;-)

As usual, I could not resist the urge to edit the commit log, and I also
added the "(void)" to indicate that the code intends to ignore the return
value, as it now uses elapsed time to make its decisions.

Please let me know if I messed anything up.

							Thanx, Paul

------------------------------------------------------------------------

commit 48434fc6700c31bd258713c24b78053fe47d393e
Author: Liu Song <liu.song11@zte.com.cn>
Date:   Tue Jun 29 21:55:51 2021 +0800

    rcu: Remove useless "ret" update in rcu_gp_fqs_loop()
    
    Within rcu_gp_fqs_loop(), the "ret" local variable is set to the
    return value from swait_event_idle_timeout_exclusive(), but "ret" is
    unconditionally overwritten later in the code.  This commit therefore
    removes this useless assignment.
    
    Signed-off-by: Liu Song <liu.song11@zte.com.cn>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 35ed10bb95ef..a627a200a5ae 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1958,8 +1958,8 @@ static noinline_for_stack void rcu_gp_fqs_loop(void)
 		trace_rcu_grace_period(rcu_state.name, rcu_state.gp_seq,
 				       TPS("fqswait"));
 		WRITE_ONCE(rcu_state.gp_state, RCU_GP_WAIT_FQS);
-		ret = swait_event_idle_timeout_exclusive(
-				rcu_state.gp_wq, rcu_gp_fqs_check_wake(&gf), j);
+		(void)swait_event_idle_timeout_exclusive(rcu_state.gp_wq,
+				 rcu_gp_fqs_check_wake(&gf), j);
 		rcu_gp_torture_wait();
 		WRITE_ONCE(rcu_state.gp_state, RCU_GP_DOING_FQS);
 		/* Locking provides needed memory barriers. */

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

* Re: [PATCH] rcu: Remove unnecessary updates to ret in rcu_gp_fqs_loop
       [not found]   ` <202106301122531910761@zte.com.cn>
@ 2021-06-30  4:23     ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2021-06-30  4:23 UTC (permalink / raw)
  To: liu.song11; +Cc: fishland, linux-kernel

On Wed, Jun 30, 2021 at 11:22:53AM +0800, liu.song11@zte.com.cn wrote:
> > rcu: Remove useless "ret" update in rcu_gp_fqs_loop()
> >      
> >     Within rcu_gp_fqs_loop(), the "ret" local variable is set to the
> >     return value from swait_event_idle_timeout_exclusive(), but "ret" is
> >     unconditionally overwritten later in the code.  This commit therefore
> >     removes this useless assignment.
> 
> The revised commit log is exactly what I want to express, it is perfect.

Thank you for looking it over!

							Thanx, Paul

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

end of thread, other threads:[~2021-06-30  4:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210629135551.4080-1-fishland@aliyun.com>
2021-06-29 17:44 ` [PATCH] rcu: Remove unnecessary updates to ret in rcu_gp_fqs_loop Paul E. McKenney
     [not found]   ` <202106301122531910761@zte.com.cn>
2021-06-30  4:23     ` Paul E. McKenney

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).