Skip to contentSkip to conversation

block/020: dynamically change iodepth if test aio-nr lager than aio-max-nr

PATCH Superseded Xiao Liang 2 participants 2 messages Apr 1, 2019 – Apr 4, 2019 Block layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xiao Liang

author
#0 lore raw

PATCH 1/1 block/020: dynamically change iodepth if test aio-nr lager than aio-max-nr

When system has large count of cpus(eg. 96), the test failed as aio-nr over aio-max-nr limitation.

This patch continues to use 1024 as default iodepth, but change it if iodepth*$(nproc) > aio-max-nr.

---
 tests/block/020 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tests/block/020 +7 -1
index 39dde66..f03c131 100755
@@ -29,10 +29,16 @@ test() {
 	# shellcheck disable=SC2207
 	scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
 
+	aio_max_nr=$(cat /proc/sys/fs/aio-max-nr)
+	max_iodepth=$(($aio_max_nr/$(nproc)))
+	iodepth=1024
+	if (( $iodepth > $max_iodepth )); then
+		iodepth=$max_iodepth
+	fi
 	for sched in "${scheds[@]}"; do
 		echo "Testing $sched" >> "$FULL"
 		echo "$sched" > /sys/block/nullb0/queue/scheduler
-		_fio_perf --bs=4k --ioengine=libaio --iodepth=1024 \
+		_fio_perf --bs=4k --ioengine=libaio --iodepth=$iodepth \
 			--numjobs="$(nproc)" --rw=randread --name=async \
 			--filename=/dev/nullb0 --size=1g --direct=1 \
 			--runtime=10
Signature · 1 line
2.17.2
#1 lore raw
Quoted 16 lines · Xiao Liang

When system has large count of cpus(eg. 96), the test failed as aio-nr over aio-max-nr limitation.

This patch continues to use 1024 as default iodepth, but change it if iodepth*$(nproc) > aio-max-nr.

---
 tests/block/020 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tests/block/020 +0 -0
index 39dde66..f03c131 100755

tests/block/020 test() { · line 37

Quoted 9 lines
tests/block/020 +6 -0
@@ -29,10 +29,16 @@ test() {
 	# shellcheck disable=SC2207
 	scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
 
+	aio_max_nr=$(cat /proc/sys/fs/aio-max-nr)
+	max_iodepth=$(($aio_max_nr/$(nproc)))
+	iodepth=1024
+	if (( $iodepth > $max_iodepth )); then
+		iodepth=$max_iodepth
+	fi

This has a few shellcheck errors:

tests/block/020:33:17: note: $/${} is unnecessary on arithmetic variables. [SC2004] tests/block/020:35:8: note: $/${} is unnecessary on arithmetic variables. [SC2004] tests/block/020:35:19: note: $/${} is unnecessary on arithmetic variables. [SC2004]

Can you please address those and resend?

Thanks!