Skip to content

Commit 80c503e

Browse files
committed
locktorture: 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. And this turns out to be not only a day-zero bug, but entirely my own fault. I hate it when that happens! Fixes: 0af3fe1 ("locktorture: Add a lock-torture kernel module") Reported-by: Will Deacon <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Acked-by: Will Deacon <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Peter Zijlstra <[email protected]>
1 parent bb6d3fb commit 80c503e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/locking/locktorture.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,10 @@ static void __torture_print_stats(char *page,
696696
if (statp[i].n_lock_fail)
697697
fail = true;
698698
sum += statp[i].n_lock_acquired;
699-
if (max < statp[i].n_lock_fail)
700-
max = statp[i].n_lock_fail;
701-
if (min > statp[i].n_lock_fail)
702-
min = statp[i].n_lock_fail;
699+
if (max < statp[i].n_lock_acquired)
700+
max = statp[i].n_lock_acquired;
701+
if (min > statp[i].n_lock_acquired)
702+
min = statp[i].n_lock_acquired;
703703
}
704704
page += sprintf(page,
705705
"%s: Total: %lld Max/Min: %ld/%ld %s Fail: %d %s\n",

0 commit comments

Comments
 (0)