linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Liu Song <fishland@aliyun.com>
Cc: liu.song11@zte.com.cn, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rcu: Remove unnecessary updates to ret in rcu_gp_fqs_loop
Date: Tue, 29 Jun 2021 10:44:08 -0700	[thread overview]
Message-ID: <20210629174408.GS4397@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <20210629135551.4080-1-fishland@aliyun.com>

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. */

       reply	other threads:[~2021-06-29 17:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210629135551.4080-1-fishland@aliyun.com>
2021-06-29 17:44 ` Paul E. McKenney [this message]
     [not found]   ` <202106301122531910761@zte.com.cn>
2021-06-30  4:23     ` [PATCH] rcu: Remove unnecessary updates to ret in rcu_gp_fqs_loop Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210629174408.GS4397@paulmck-ThinkPad-P17-Gen-1 \
    --to=paulmck@kernel.org \
    --cc=fishland@aliyun.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liu.song11@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).