rcuscale: Console output claims too few grace periods
authorJiangong.Han <jiangong.han@windriver.com>
Tue, 22 Jun 2021 10:37:08 +0000 (18:37 +0800)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 27 Jul 2021 18:39:30 +0000 (11:39 -0700)
commit811192c5f24bfd7246ce9ce06f668d8c408bf39b
tree4e4faa6ce8b334a463ca2c290911885eddbcecad
parent59e836662860a28880d45b35e1fbc5afca4847ce
rcuscale: Console output claims too few grace periods

The rcuscale console output claims N grace periods, numbered from zero
to N, which means that there were really N+1 grace periods.  The root
cause of this bug is that rcu_scale_writer() stores the number of the
last grace period (numbered from zero) into writer_n_durations[me]
instead of the number of grace periods.  This commit therefore assigns
the actual number of grace periods to writer_n_durations[me], and also
makes the corresponding adjustment to the loop outputting per-grace-period
measurements.

Sample of old console output:
    rcu-scale: writer 0 gps: 133
    ......
    rcu-scale:    0 writer-duration:     0 44003961
    rcu-scale:    0 writer-duration:     1 32003582
    ......
    rcu-scale:    0 writer-duration:   132 28004391
    rcu-scale:    0 writer-duration:   133 27996410

Sample of new console output:
    rcu-scale: writer 0 gps: 134
    ......
    rcu-scale:    0 writer-duration:     0 44003961
    rcu-scale:    0 writer-duration:     1 32003582
    ......
    rcu-scale:    0 writer-duration:   132 28004391
    rcu-scale:    0 writer-duration:   133 27996410

Signed-off-by: Jiangong.Han <jiangong.han@windriver.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/rcuscale.c