rcu: Trace end of grace period before end of grace period
authorPaul E. McKenney <paulmck@linux.ibm.com>
Mon, 15 Oct 2018 17:00:58 +0000 (10:00 -0700)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Mon, 12 Nov 2018 17:03:59 +0000 (09:03 -0800)
Currently, rcu_gp_cleanup() traces the end of the old grace period after
the old grace period has officially ended.  This might make intuitive
sense, but it also makes for confusing event-trace output because the
"end" trace displays not the old but instead the new grace-period number.
This commit therefore traces the end of an old grace period just before
that grace period officially ends.

Reported-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
kernel/rcu/tree.c

index 429a46fb087a517d7bc3f1fa1e7e166fe571a467..61bae41b1afe171ee40513f07e9aa27e48bfd679 100644 (file)
@@ -2035,9 +2035,9 @@ static void rcu_gp_cleanup(void)
        rnp = rcu_get_root();
        raw_spin_lock_irq_rcu_node(rnp); /* GP before ->gp_seq update. */
 
-       /* Declare grace period done. */
-       rcu_seq_end(&rcu_state.gp_seq);
+       /* Declare grace period done, trace first to use old GP number. */
        trace_rcu_grace_period(rcu_state.name, rcu_state.gp_seq, TPS("end"));
+       rcu_seq_end(&rcu_state.gp_seq);
        rcu_state.gp_state = RCU_GP_IDLE;
        /* Check for GP requests since above loop. */
        rdp = this_cpu_ptr(&rcu_data);