All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] rcuscale: Console output claims too few grace periods
@ 2021-06-24 14:34 Jiangong.Han
  2021-06-24 16:40 ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Jiangong.Han @ 2021-06-24 14:34 UTC (permalink / raw)
  To: dave, paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: linux-kernel, rcu, Jiangong.Han

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index dca51fe9c73f..2cc34a22a506 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -487,7 +487,7 @@ rcu_scale_writer(void *arg)
 	if (gp_async) {
 		cur_ops->gp_barrier();
 	}
-	writer_n_durations[me] = i_max;
+	writer_n_durations[me] = i_max + 1;
 	torture_kthread_stopping("rcu_scale_writer");
 	return 0;
 }
@@ -561,7 +561,7 @@ rcu_scale_cleanup(void)
 			wdpp = writer_durations[i];
 			if (!wdpp)
 				continue;
-			for (j = 0; j <= writer_n_durations[i]; j++) {
+			for (j = 0; j < writer_n_durations[i]; j++) {
 				wdp = &wdpp[j];
 				pr_alert("%s%s %4d writer-duration: %5d %llu\n",
 					scale_type, SCALE_FLAG,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] rcuscale: Console output claims too few grace periods
  2021-06-24 14:34 [PATCH v3] rcuscale: Console output claims too few grace periods Jiangong.Han
@ 2021-06-24 16:40 ` Paul E. McKenney
  2021-06-25  1:44   ` Han, Jiangong
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2021-06-24 16:40 UTC (permalink / raw)
  To: Jiangong.Han
  Cc: dave, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel,
	linux-kernel, rcu

On Thu, Jun 24, 2021 at 10:34:24PM +0800, Jiangong.Han wrote:
> 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>

I already have it queued in -rcu here:

4c154a910344 ("rcuscale: Console output claims too few grace periods")

Or did you find an error in my wordsmithed version of your commit log?
If so, please point out the error explicitly.  (It looks identical to me,
but I could easily be missing something.)

							Thanx, Paul

> ---
>  kernel/rcu/rcuscale.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
> index dca51fe9c73f..2cc34a22a506 100644
> --- a/kernel/rcu/rcuscale.c
> +++ b/kernel/rcu/rcuscale.c
> @@ -487,7 +487,7 @@ rcu_scale_writer(void *arg)
>  	if (gp_async) {
>  		cur_ops->gp_barrier();
>  	}
> -	writer_n_durations[me] = i_max;
> +	writer_n_durations[me] = i_max + 1;
>  	torture_kthread_stopping("rcu_scale_writer");
>  	return 0;
>  }
> @@ -561,7 +561,7 @@ rcu_scale_cleanup(void)
>  			wdpp = writer_durations[i];
>  			if (!wdpp)
>  				continue;
> -			for (j = 0; j <= writer_n_durations[i]; j++) {
> +			for (j = 0; j < writer_n_durations[i]; j++) {
>  				wdp = &wdpp[j];
>  				pr_alert("%s%s %4d writer-duration: %5d %llu\n",
>  					scale_type, SCALE_FLAG,
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] rcuscale: Console output claims too few grace periods
  2021-06-24 16:40 ` Paul E. McKenney
@ 2021-06-25  1:44   ` Han, Jiangong
  0 siblings, 0 replies; 3+ messages in thread
From: Han, Jiangong @ 2021-06-25  1:44 UTC (permalink / raw)
  To: paulmck
  Cc: dave, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel,
	linux-kernel, rcu

Hi,  Paul,

I think your words are much clear than mine, no missings, thanks for 
your help.  :)
Thanks for your quickly response again.

Br,

Jiangong


在 2021/6/25 上午12:40, Paul E. McKenney 写道:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Thu, Jun 24, 2021 at 10:34:24PM +0800, Jiangong.Han wrote:
>> 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>
> I already have it queued in -rcu here:
>
> 4c154a910344 ("rcuscale: Console output claims too few grace periods")
>
> Or did you find an error in my wordsmithed version of your commit log?
> If so, please point out the error explicitly.  (It looks identical to me,
> but I could easily be missing something.)
>
>                                                          Thanx, Paul
>
>> ---
>>   kernel/rcu/rcuscale.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
>> index dca51fe9c73f..2cc34a22a506 100644
>> --- a/kernel/rcu/rcuscale.c
>> +++ b/kernel/rcu/rcuscale.c
>> @@ -487,7 +487,7 @@ rcu_scale_writer(void *arg)
>>        if (gp_async) {
>>                cur_ops->gp_barrier();
>>        }
>> -     writer_n_durations[me] = i_max;
>> +     writer_n_durations[me] = i_max + 1;
>>        torture_kthread_stopping("rcu_scale_writer");
>>        return 0;
>>   }
>> @@ -561,7 +561,7 @@ rcu_scale_cleanup(void)
>>                        wdpp = writer_durations[i];
>>                        if (!wdpp)
>>                                continue;
>> -                     for (j = 0; j <= writer_n_durations[i]; j++) {
>> +                     for (j = 0; j < writer_n_durations[i]; j++) {
>>                                wdp = &wdpp[j];
>>                                pr_alert("%s%s %4d writer-duration: %5d %llu\n",
>>                                        scale_type, SCALE_FLAG,
>> --
>> 2.17.1
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-25  2:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 14:34 [PATCH v3] rcuscale: Console output claims too few grace periods Jiangong.Han
2021-06-24 16:40 ` Paul E. McKenney
2021-06-25  1:44   ` Han, Jiangong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.