Skip to contentSkip to conversation

Adjust io-throttle testcases

PATCH New Wang Long 2 participants 5 messages Nov 29, 2017 – Dec 12, 2017

lore
Share & tools
lore

Wang Long

author
#0 lore raw

cover Adjust io-throttle testcases

These two patches update io-throttle thestcases to use the new blkio cgroup interface.

Wang Long (2):
adjust io-throttle testcases
Fix the way to check if the kernel has blkio cgroup enabled

 .../io-throttle/io_throttle_testplan.txt           | 11 ++----
 .../controllers/io-throttle/myfunctions-io.sh      | 43 +++++++++++++---------
 .../io-throttle/run_io_throttle_test.sh            | 41 ++++++++-------------
 testcases/kernel/controllers/test_controllers.sh   |  6 +--
 4 files changed, 48 insertions(+), 53 deletions(-)
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/2 adjust io-throttle testcases

The current io-throttle testcases only can running on the very old kernel which has the old block io cgroup interface. and the cgroup name has renamed to blkio from blockio.

This patch update them.

---
 .../io-throttle/io_throttle_testplan.txt           | 11 ++----
 .../controllers/io-throttle/myfunctions-io.sh      | 43 +++++++++++++---------
 .../io-throttle/run_io_throttle_test.sh            | 41 ++++++++-------------
 3 files changed, 45 insertions(+), 50 deletions(-)
testcases/kernel/controllers/io-throttle/io_throttle_testplan.txt +4 -7
index fa5b85b..b726e40 100644
@@ -21,15 +21,12 @@ limitations:
 Each test is considered passed only if the I/O limitations above are respected.
 
 Currently the following different scenarios are tested:
-- 1 single stream per cgroup using leaky-bucket I/O throttling
-- 1 single stream per cgroup using token-bucket I/O throttling
-- 2 parallel streams per cgroup using leaky-bucket I/O throttling
-- 2 parallel streams per cgroup using token-bucket I/O throttling
-- 4 parallel streams per cgroup using leaky-bucket I/O throttling
-- 4 parallel streams per cgroup using token-bucket I/O throttling
+- 1 single stream per cgroup I/O throttling
+- 2 parallel streams per cgroup I/O throttling
+- 4 parallel streams per cgroup I/O throttling
 
 For any other information please refer to
-Documentation/controllers/io-throttle.txt in kernel documentation.
+Documentation/cgroup-v1/blkio-controller.txt in kernel documentation.
 
 Questions?
 ----------
testcases/kernel/controllers/io-throttle/myfunctions-io.sh +26 -17

62 lines not on this page · raw message

testcases/kernel/controllers/io-throttle/run_io_throttle_test.sh +15 -26

89 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/2 adjust io-throttle testcases

Hi!
(just resending so that Sebastian who recently subscribed to the list
can comment)

Quoted 210 lines

The current io-throttle testcases only can running on the very old kernel which has the old block io cgroup interface. and the cgroup name has renamed to blkio from blockio.

This patch update them.

---
 .../io-throttle/io_throttle_testplan.txt           | 11 ++----
 .../controllers/io-throttle/myfunctions-io.sh      | 43 +++++++++++++---------
 .../io-throttle/run_io_throttle_test.sh            | 41 ++++++++-------------
 3 files changed, 45 insertions(+), 50 deletions(-)
testcases/kernel/controllers/io-throttle/io_throttle_testplan.txt +4 -7
index fa5b85b..b726e40 100644
@@ -21,15 +21,12 @@ limitations:
 Each test is considered passed only if the I/O limitations above are respected.
 
 Currently the following different scenarios are tested:
-- 1 single stream per cgroup using leaky-bucket I/O throttling
-- 1 single stream per cgroup using token-bucket I/O throttling
-- 2 parallel streams per cgroup using leaky-bucket I/O throttling
-- 2 parallel streams per cgroup using token-bucket I/O throttling
-- 4 parallel streams per cgroup using leaky-bucket I/O throttling
-- 4 parallel streams per cgroup using token-bucket I/O throttling
+- 1 single stream per cgroup I/O throttling
+- 2 parallel streams per cgroup I/O throttling
+- 4 parallel streams per cgroup I/O throttling
 
 For any other information please refer to
-Documentation/controllers/io-throttle.txt in kernel documentation.
+Documentation/cgroup-v1/blkio-controller.txt in kernel documentation.
 
 Questions?
 ----------
testcases/kernel/controllers/io-throttle/myfunctions-io.sh +26 -17
index bf4bb2b..b604520 100755
@@ -19,27 +19,34 @@
 #
 # usage . myfunctions.sh
 
+mounted=1
+
 setup()
 {
 	# create testcase cgroups
-	if [ -e /dev/blockioctl ]; then
-		echo "WARN: /dev/blockioctl already exist! overwriting."
-		cleanup
-	fi
-	mkdir /dev/blockioctl
-	mount -t cgroup -o blockio cgroup /dev/blockioctl
-	if [ $? -ne 0 ]; then
-		echo "ERROR: could not mount cgroup filesystem " \
-			" on /dev/blockioctl. Exiting test."
-		cleanup
-		exit 1
+	mount_point=`grep -w blkio /proc/mounts | cut -f 2 | cut -d " " -f2`
+	if [ "$mount_point" = "" ]; then
+		mounted=0
+		mount_point=/dev/cgroup
 	fi
+
+	if [ "$mounted" -eq "0" ]; then
+		mkdir -p $mount_point
+		mount -t cgroup -o blkio none $mount_point
+		if [ $? -ne 0 ]; then
+			echo "ERROR: could not mount cgroup filesystem " \
+			" on $mount_point. Exiting test."
+			cleanup
+			exit 1
+		fi
+        fi
+
 	for i in `seq 1 3`; do
-		if [ -e /dev/blockioctl/cgroup-$i ]; then
-			rmdir /dev/blockioctl/cgroup-$i
+		if [ -e $mount_point/cgroup-$i ]; then
+			rmdir $mount_point/cgroup-$i
 			echo "WARN: earlier cgroup-$i found and removed"
 		fi
-		mkdir /dev/blockioctl/cgroup-$i
+		mkdir $mount_point/cgroup-$i
 		if [ $? -ne 0 ]; then
 			echo "ERROR: could not create cgroup-$i" \
 				"Check your permissions. Exiting test."
@@ -53,9 +60,11 @@ cleanup()
 {
 	echo "Cleanup called"
 	for i in `seq 1 3`; do
-		rmdir /dev/blockioctl/cgroup-$i
+		rmdir $mount_point/cgroup-$i
 		rm -f /tmp/cgroup-$i.out
 	done
-	umount /dev/blockioctl
-	rmdir /dev/blockioctl
+	if [ "$mounted" -eq "0" ]; then
+		umount $mount_point
+		rmdir $mount_point
+	fi
 }
testcases/kernel/controllers/io-throttle/run_io_throttle_test.sh +15 -26
index c855fd0..7e591be 100755
@@ -25,12 +25,15 @@
 trap cleanup SIGINT
 
 BUFSIZE=16m
-DATASIZE=64m
+DATASIZE=320m
 
 setup
 
-# get the device name of the entire mounted block device
+# get the major and minor device type of the entire mounted block device
 dev=`df -P . | sed '1d' | cut -d' ' -f1 | sed 's/[p]*[0-9]*$//'`
+dev_major=`stat -L -c %t $dev`
+dev_minor=`stat -L -c %T $dev`
+devtype=`printf "%d:%d" 0x$dev_major 0x$dev_minor`
 
 # evaluate device bandwidth
 export MYGROUP=
@@ -49,22 +52,13 @@ for i in `seq 1 3`; do
 done
 
 for tasks in 1 2 4; do
-for strategy in 0 1; do
-	# set bw limiting rules
-	if [ -f /dev/blockioctl/blockio.bandwidth ]; then
-		io_throttle_file=blockio.bandwidth
-	elif [ -f /dev/blockioctl/blockio.bandwidth-max ]; then
-		io_throttle_file=blockio.bandwidth-max
-	else
-		echo "ERROR: unknown kernel ABI. Exiting test."
-		cleanup
-		exit 1
-	fi
 	for i in `seq 1 3`; do
 		limit=$(($phys_bw * 1024 / `echo 2^$i | bc`))
 		IOBW[$i]=$(($limit / 1024))
-		/bin/echo $dev:$limit:$strategy:$limit > \
-			/dev/blockioctl/cgroup-$i/${io_throttle_file}
+		/bin/echo "$devtype $limit" > \
+			$mount_point/cgroup-$i/blkio.throttle.read_bps_device
+		/bin/echo "$devtype $limit" > \
+			$mount_point/cgroup-$i/blkio.throttle.write_bps_device
 		if [ $? -ne 0 ]; then
 			echo "ERROR: could not set i/o bandwidth limit for cgroup-$i. Exiting test."
 			cleanup
@@ -79,14 +73,10 @@ for strategy in 0 1; do
 		stream="streams"
 	fi
 	echo -n ">> testing $tasks parallel $stream per cgroup "
-	if [ $strategy -eq 0 ]; then
-		echo "(leaky-bucket i/o throttling)"
-	else
-		echo "(token-bucket i/o throttling)"
-	fi
+	echo ""
 	for i in `seq 1 3`; do
 		MYGROUP=cgroup-$i
-		/bin/echo $$ > /dev/blockioctl/$MYGROUP/tasks
+		/bin/echo $$ > $mount_point/$MYGROUP/tasks
 		if [ $? -ne 0 ]; then
 			echo "ERROR: could not set i/o bandwidth limit for cgroup-$i. Exiting test."
 			cleanup
@@ -96,7 +86,7 @@ for strategy in 0 1; do
 		./iobw -direct $tasks $BUFSIZE $DATASIZE > /tmp/$MYGROUP.out &
 		PID[$i]=$!
 	done
-	/bin/echo $$ > /dev/blockioctl/tasks
+	/bin/echo $$ > $mount_point/tasks
 
 	# wait for children completion
 	for i in `seq 1 3`; do
@@ -104,7 +94,7 @@ for strategy in 0 1; do
 		wait ${PID[$i]}
 		ret=$?
 		if [ $ret -ne 0 ]; then
-			echo "ERROR: error code $ret during test $tasks.$strategy.$i. Exiting test."
+			echo "ERROR: error code $ret during test $tasks.$i. Exiting test."
 			cleanup
 			exit 1
 		fi
@@ -112,12 +102,11 @@ for strategy in 0 1; do
 		diff=$((${IOBW[$i]} - $iorate))
 		echo "($MYGROUP) i/o-bw ${IOBW[$i]} KiB/s, i/o-rate $iorate KiB/s, err $diff KiB/s"
 		if [ ${IOBW[$i]} -ge $iorate ]; then
-			echo "TPASS   Block device I/O bandwidth controller: test $tasks.$strategy.$i PASSED";
+			echo "TPASS   Block device I/O bandwidth controller: test $tasks.$i PASSED";
 		else
-			echo "TFAIL   Block device I/O bandwidth controller: test $tasks.$strategy.$i FAILED";
+			echo "TFAIL   Block device I/O bandwidth controller: test $tasks.$i FAILED";
 		fi
 	done
 done
-done
 
 cleanup
Signature · 5 lines
1.8.3.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis
[email protected]
author
#3 lore raw

PATCH 2/2 Fix the way to check if the kernel has blkio cgroup enabled

In reply to Wang Long

This patch simple rename blockio to blkio.

---
 testcases/kernel/controllers/test_controllers.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/controllers/test_controllers.sh +3 -3
index 7aa974f..a5629a1 100755
@@ -43,8 +43,8 @@ then
 	CPU_CONTROLLER_VALUE=`grep -w cpu /proc/cgroups | cut -f4`;
 	MEM_CONTROLLER=`grep -w memory /proc/cgroups | cut -f1`;
 	MEM_CONTROLLER_VALUE=`grep -w memory /proc/cgroups | cut -f4`;
-	IOTHROTTLE_CONTROLLER=`grep -w blockio /proc/cgroups | cut -f1`;
-	IOTHROTTLE_CONTROLLER_VALUE=`grep -w blockio /proc/cgroups | cut -f4`;
+	BLKIO_CONTROLLER=`grep -w blkio /proc/cgroups | cut -f1`;
+	BLKIO_CONTROLLER_VALUE=`grep -w blkio /proc/cgroups | cut -f4`;
 	FREEZER=`grep -w freezer /proc/cgroups | cut -f1`;
 	FREEZER_VALUE=`grep -w freezer /proc/cgroups | cut -f4`;
 	CPUACCOUNT_CONTROLLER=`grep -w cpuacct /proc/cgroups | cut -f1`
@@ -82,7 +82,7 @@ then
 		echo "Skipping all memory controller testcases....";
 	fi
 
-	if [ "$IOTHROTTLE_CONTROLLER" = "blockio" ] && [ "$IOTHROTTLE_CONTROLLER_VALUE" = "1" ]
+	if [ "$BLKIO_CONTROLLER" = "blkio" ] && [ "$BLKIO_CONTROLLER_VALUE" = "1" ]
 	then
 		$LTPROOT/testcases/bin/run_io_throttle_test.sh;
 	else
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 2/2 Fix the way to check if the kernel has blkio cgroup enabled

Hi!
(the same)

Quoted 37 lines

This patch simple rename blockio to blkio.

---
 testcases/kernel/controllers/test_controllers.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/controllers/test_controllers.sh +3 -3
index 7aa974f..a5629a1 100755
@@ -43,8 +43,8 @@ then
 	CPU_CONTROLLER_VALUE=`grep -w cpu /proc/cgroups | cut -f4`;
 	MEM_CONTROLLER=`grep -w memory /proc/cgroups | cut -f1`;
 	MEM_CONTROLLER_VALUE=`grep -w memory /proc/cgroups | cut -f4`;
-	IOTHROTTLE_CONTROLLER=`grep -w blockio /proc/cgroups | cut -f1`;
-	IOTHROTTLE_CONTROLLER_VALUE=`grep -w blockio /proc/cgroups | cut -f4`;
+	BLKIO_CONTROLLER=`grep -w blkio /proc/cgroups | cut -f1`;
+	BLKIO_CONTROLLER_VALUE=`grep -w blkio /proc/cgroups | cut -f4`;
 	FREEZER=`grep -w freezer /proc/cgroups | cut -f1`;
 	FREEZER_VALUE=`grep -w freezer /proc/cgroups | cut -f4`;
 	CPUACCOUNT_CONTROLLER=`grep -w cpuacct /proc/cgroups | cut -f1`
@@ -82,7 +82,7 @@ then
 		echo "Skipping all memory controller testcases....";
 	fi
 
-	if [ "$IOTHROTTLE_CONTROLLER" = "blockio" ] && [ "$IOTHROTTLE_CONTROLLER_VALUE" = "1" ]
+	if [ "$BLKIO_CONTROLLER" = "blkio" ] && [ "$BLKIO_CONTROLLER_VALUE" = "1" ]
 	then
 		$LTPROOT/testcases/bin/run_io_throttle_test.sh;
 	else
Signature · 5 lines
1.8.3.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis
[email protected]