Skip to contentSkip to conversation

Print ratio of acquisitions, not failures

RFC PATCH In review Paul E. McKenney 3 participants 3 messages Jan 23, 2020 – Jan 31, 2020 Torture-test modules

lore
Share & tools
lore

Paul E. McKenney

author maintainer
#0 lore raw

RFC PATCH 1/1 Print ratio of acquisitions, not failures

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.

Cc Davidlohr Bueso <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Peter Zijlstra <[email protected]>
kernel/locking/locktorture.c +4 -4
index 99475a6..687c1d8 100644
@@ -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 on v1 1/1
#1 lore raw
Quoted 9 lines · Paul E. McKenney
kernel/locking/locktorture.c +0 -1
index 99475a6..687c1d8 100644
@@ -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)

kernel/locking/locktorture.c static void __torture_print_stats(char *page, · line 705

Quoted 10 lines
kernel/locking/locktorture.c +4 -3
-			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",

Will

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Paul E. McKenney
Quoted 7 lines · Paul E. McKenney

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!

Quoted 6 lines
Cc Davidlohr Bueso <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Peter Zijlstra <[email protected]>