linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC locktorture] Print ratio of acquisitions, not failures
@ 2020-01-23 17:27 Paul E. McKenney
  2020-01-31 13:13 ` Will Deacon
  2020-01-31 17:40 ` Davidlohr Bueso
  0 siblings, 2 replies; 3+ messages in thread
From: Paul E. McKenney @ 2020-01-23 17:27 UTC (permalink / raw)
  To: dave, josh; +Cc: linux-kernel, will, peterz

The __torture_print_stats() function in locktorture.c carefully
initializes local variable "min" to statp[0].n_lock_acquired, but
then compares it to statp[i].n_lock_fail.  Given that the .n_lock_fail
field should normally be zero, and given the initialization, it seems
reasonable to display the maximum and minimum number acquisitions
instead of miscomputing the maximum and minimum number of failures.
This commit therefore switches from failures to acquisitions.

Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Peter Zijlstra <peterz@infradead.org>

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 99475a6..687c1d8 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -696,10 +696,10 @@ static void __torture_print_stats(char *page,
 		if (statp[i].n_lock_fail)
 			fail = true;
 		sum += statp[i].n_lock_acquired;
-		if (max < statp[i].n_lock_fail)
-			max = statp[i].n_lock_fail;
-		if (min > statp[i].n_lock_fail)
-			min = statp[i].n_lock_fail;
+		if (max < statp[i].n_lock_acquired)
+			max = statp[i].n_lock_acquired;
+		if (min > statp[i].n_lock_acquired)
+			min = statp[i].n_lock_acquired;
 	}
 	page += sprintf(page,
 			"%s:  Total: %lld  Max/Min: %ld/%ld %s  Fail: %d %s\n",

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

* Re: [PATCH RFC locktorture] Print ratio of acquisitions, not failures
  2020-01-23 17:27 [PATCH RFC locktorture] Print ratio of acquisitions, not failures Paul E. McKenney
@ 2020-01-31 13:13 ` Will Deacon
  2020-01-31 17:40 ` Davidlohr Bueso
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2020-01-31 13:13 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: dave, josh, linux-kernel, peterz

On Thu, Jan 23, 2020 at 09:27:07AM -0800, Paul E. McKenney wrote:
> diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
> index 99475a6..687c1d8 100644
> --- a/kernel/locking/locktorture.c
> +++ b/kernel/locking/locktorture.c
> @@ -696,10 +696,10 @@ static void __torture_print_stats(char *page,
>  		if (statp[i].n_lock_fail)
>  			fail = true;
>  		sum += statp[i].n_lock_acquired;
> -		if (max < statp[i].n_lock_fail)
> -			max = statp[i].n_lock_fail;
> -		if (min > statp[i].n_lock_fail)
> -			min = statp[i].n_lock_fail;
> +		if (max < statp[i].n_lock_acquired)
> +			max = statp[i].n_lock_acquired;
> +		if (min > statp[i].n_lock_acquired)
> +			min = statp[i].n_lock_acquired;
>  	}
>  	page += sprintf(page,
>  			"%s:  Total: %lld  Max/Min: %ld/%ld %s  Fail: %d %s\n",

Acked-by: Will Deacon <will@kernel.org>

Will


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

* Re: [PATCH RFC locktorture] Print ratio of acquisitions, not failures
  2020-01-23 17:27 [PATCH RFC locktorture] Print ratio of acquisitions, not failures Paul E. McKenney
  2020-01-31 13:13 ` Will Deacon
@ 2020-01-31 17:40 ` Davidlohr Bueso
  1 sibling, 0 replies; 3+ messages in thread
From: Davidlohr Bueso @ 2020-01-31 17:40 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: josh, linux-kernel, will, peterz

On Thu, 23 Jan 2020, Paul E. McKenney wrote:

>The __torture_print_stats() function in locktorture.c carefully
>initializes local variable "min" to statp[0].n_lock_acquired, but
>then compares it to statp[i].n_lock_fail.  Given that the .n_lock_fail
>field should normally be zero, and given the initialization, it seems
>reasonable to display the maximum and minimum number acquisitions
>instead of miscomputing the maximum and minimum number of failures.
>This commit therefore switches from failures to acquisitions.

This makes sense, thanks!

>
>Reported-by: Will Deacon <will@kernel.org>
>Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>Cc: Davidlohr Bueso <dave@stgolabs.net>
>Cc: Josh Triplett <josh@joshtriplett.org>
>Cc: Peter Zijlstra <peterz@infradead.org>

Acked-by: Davidlohr Bueso <dbueso@suse.de>

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

end of thread, other threads:[~2020-01-31 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23 17:27 [PATCH RFC locktorture] Print ratio of acquisitions, not failures Paul E. McKenney
2020-01-31 13:13 ` Will Deacon
2020-01-31 17:40 ` Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).