On Wed, Jul 23, 2014 at 01:09:43AM -0400, Pranith Kumar wrote:
> We are clearing the gp_flags before we check if a grace period is in progress.
> If a grace period is in progress, we return after incorrectly clearing the
> gp_flags. The code comments say that this is highly unlikely, but just to be
> safe this commit moves the clearing of gp_flags to after the check for grace
> period in progress.
> 
> Signed-off-by: Pranith Kumar <bobby.pr...@gmail.com>

Sorry, but no.  The WARN_ON_ONCE() indicates an error condition.  It should
not be possible to have a grace period already in progress at this point
in the code.  So the two locations for the clearing of ->gp_flags are
equivalent.

                                                        Thanx, Paul

> ---
>  kernel/rcu/tree.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 044946e..b14cecd 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1605,7 +1605,6 @@ static int rcu_gp_init(struct rcu_state *rsp)
>               raw_spin_unlock_irq(&rnp->lock);
>               return 0;
>       }
> -     ACCESS_ONCE(rsp->gp_flags) = 0; /* Clear all flags: New grace period. */
> 
>       if (WARN_ON_ONCE(rcu_gp_in_progress(rsp))) {
>               /*
> @@ -1616,6 +1615,8 @@ static int rcu_gp_init(struct rcu_state *rsp)
>               return 0;
>       }
> 
> +     ACCESS_ONCE(rsp->gp_flags) = 0; /* Clear all flags: New grace period. */
> +
>       /* Advance to a new grace period and initialize state. */
>       record_gp_stall_check_time(rsp);
>       /* Record GP times before starting GP, hence smp_store_release(). */
> -- 
> 2.0.0.rc2
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to