lkml.org 
[lkml]   [2021]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH rcu 15/18] rcu: Remove useless "ret" update in rcu_gp_fqs_loop()
On Tue, Aug 03, 2021 at 09:48:23AM -0700, Joe Perches wrote:
> On Wed, 2021-07-21 at 13:21 -0700, Paul E. McKenney wrote:
> > From: Liu Song <liu.song11@zte.com.cn>
> >
> > 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.
> []
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> []
> > @@ -1960,8 +1960,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);
>
> It doesn't seem this is a __must_check routine so why
> bother to cast to void ?

As a hint to the reader that discarding the return value is intentional
rather than an oversight.

Thanx, Paul

> >   rcu_gp_torture_wait();
> >   WRITE_ONCE(rcu_state.gp_state, RCU_GP_DOING_FQS);
> >   /* Locking provides needed memory barriers. */
>
>

\
 
 \ /
  Last update: 2021-08-03 19:11    [W:0.109 / U:1.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site