helper_thread: fix inconsistent status intervals
authorVincent Fu <vincent.fu@wdc.com>
Tue, 28 Apr 2020 18:16:46 +0000 (12:16 -0600)
committerVincent Fu <vincent.fu@wdc.com>
Wed, 29 Apr 2020 11:23:21 +0000 (05:23 -0600)
commit0f77d30d90b809fbf233b9474cc5d17c6bf73541
tree2946a6b0e82fc67b1d41271f438c449737e9e146
parent0e59dd68fcce7a5c77ba5bf1239d79a28c4006a0
helper_thread: fix inconsistent status intervals

The signal handler safety changes to the helper thread have resulted in
inconsistent status-interval intervals. Consider the following:

$ ./fio-canonical/fio --name=test --rw=randwrite --ioengine=libaio --direct=1 --runtime=180 --time_based --filename=/dev/fioa --output=write-canonical.out --minimal --status-interval=1
$ cut -d ';' -f 50 < write-canonical.out | awk 'NR>1{print $1-p} {p=$1}' | sort -n | tail
1002
1002
1002
1002
1002
1042
1046
1251
1252
1252

Several of the status-interval output lines are ~1250ms apart.

This patch moves code for triggering the status-interval output from the main
fio process to the helper thread. The resulting intervals are much closer to
the desired 1000ms.

$ ./fio/fio --name=test --rw=randwrite --ioengine=libaio --direct=1 --runtime=180 --time_based --filename=/dev/fioa --minimal --status-interval=1 --output=write-test.out
$ cut -d ';' -f 50 < write-test.out | awk 'NR>1{print $1-p} {p=$1}' | sort -n | tail
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001

Reported-by: <nate.rivers@wdc.com>
Fixes: 31eca641ad91 ("Fix a potential deadlock in helper_do_stat()")
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
helper_thread.c
stat.c