All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/023: performance test on queue creation & cleanup
@ 2018-07-04  5:29 Ming Lei
  2018-07-25 21:33 ` Omar Sandoval
  0 siblings, 1 reply; 3+ messages in thread
From: Ming Lei @ 2018-07-04  5:29 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: Jens Axboe, linux-block, Ming Lei

SCSI may have lots of channels, targets or LUNs, so it may
take long time for creating and cleaning up queues.

So introduce block/023 and uses null_blk to run this test
on both blk-mq and legacy mode, then compare both and check
the difference.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 tests/block/023     | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/block/023.out |   2 ++
 2 files changed, 103 insertions(+)
 create mode 100755 tests/block/023
 create mode 100755 tests/block/023.out

diff --git a/tests/block/023 b/tests/block/023
new file mode 100755
index 000000000000..5a8f323bd42a
--- /dev/null
+++ b/tests/block/023
@@ -0,0 +1,101 @@
+#!/bin/bash
+#
+# Performance regression test on blk-mq queue creation & cleanup. Measure
+# the time for creating & cleaning up null_blk queues in both legacy and
+# blk-mq mode, then compare both & check if there is performance regression.
+#
+# Copyright (C) 2018 Ming Lei
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. tests/block/rc
+
+DESCRIPTION="performance regression test on null_blk queue creation & cleanup"
+QUICK=1
+
+requires() {
+	_have_module null_blk
+}
+
+remove_null_blk_mod() {
+	delay=$1
+	while true; do
+		modprobe -r null_blk > /dev/null 2>&1
+		[ $? -eq 0 ] && break
+		sleep $delay
+	done
+}
+
+test_null_blk_queue_perf() {
+	QUEUE_MODE=$1
+
+	remove_null_blk_mod 1
+
+	start_time=`date +'%s'`
+	modprobe null_blk nr_devices=4096 queue_mode=$QUEUE_MODE
+	end_time=`date +'%s'`
+	create_time=`expr $end_time - $start_time + 1`
+
+	start_time=`date +'%s'`
+	remove_null_blk_mod 0.1
+	end_time=`date +'%s'`
+	cleanup_time=`expr $end_time - $start_time + 1`
+
+	echo $create_time $cleanup_time
+}
+
+check_diff() {
+	src=$1
+	dst=$2
+	msg=$3
+
+	diff=`expr $dst - $src`
+	[ $diff -le 10 ] && return
+
+	result=`echo "scale=0;($diff - $src * 0.4) / 1" | bc`
+	[ $result -ge 0 ] && echo $msg
+}
+
+check_limit() {
+	src=$1
+	dst=$2
+	msg=$3
+
+	result=`echo "scale=0;$dst - $src * 20" | bc`
+	[ $result -ge 0 ] && echo $msg
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	rq_time=($(test_null_blk_queue_perf 1))
+	mq_time=($(test_null_blk_queue_perf 2))
+
+	echo ${rq_time[0]} ${mq_time[0]} >> "$FULL"
+	echo ${rq_time[1]} ${mq_time[1]} >> "$FULL"
+
+	msg="blk_mq takes too long(${mq_time[0]}s) to create queues compared with block rq(${rq_time[0]}s)"
+	check_diff ${rq_time[0]} ${mq_time[0]} "$msg"
+
+	msg="blk_mq takes too long(${mq_time[1]}s) to cleanup queues compared with block rq(${rq_time[1]}s)"
+	check_diff ${rq_time[1]} ${mq_time[1]} "$msg"
+
+	msg="block rq takes too long(${rq_time[1]}s) to cleanup queues compared with creating queues(${rq_time[0]}s)"
+	check_limit ${rq_time[0]} ${rq_time[1]} "$msg"
+
+	msg="blk_mq takes too long(${mq_time[1]}s) to cleanup queues compared with creating queues(${mq_time[0]}s)"
+	check_limit ${mq_time[0]} ${mq_time[1]} "$msg"
+
+	echo "Test complete"
+}
diff --git a/tests/block/023.out b/tests/block/023.out
new file mode 100755
index 000000000000..4a11db1f10fe
--- /dev/null
+++ b/tests/block/023.out
@@ -0,0 +1,2 @@
+Running block/023
+Test complete
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block/023: performance test on queue creation & cleanup
  2018-07-04  5:29 [PATCH] block/023: performance test on queue creation & cleanup Ming Lei
@ 2018-07-25 21:33 ` Omar Sandoval
  2018-07-29 22:43   ` Ming Lei
  0 siblings, 1 reply; 3+ messages in thread
From: Omar Sandoval @ 2018-07-25 21:33 UTC (permalink / raw)
  To: Ming Lei; +Cc: Omar Sandoval, Jens Axboe, linux-block

On Wed, Jul 04, 2018 at 01:29:56PM +0800, Ming Lei wrote:
> SCSI may have lots of channels, targets or LUNs, so it may
> take long time for creating and cleaning up queues.
> 
> So introduce block/023 and uses null_blk to run this test
> on both blk-mq and legacy mode, then compare both and check
> the difference.
> 
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
>  tests/block/023     | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/block/023.out |   2 ++
>  2 files changed, 103 insertions(+)
>  create mode 100755 tests/block/023
>  create mode 100755 tests/block/023.out

Hi, Ming, is this a regression test for "blk-mq: remove
synchronize_rcu() from blk_mq_del_queue_tag_set()" and "blk-mq: avoid to
synchronize rcu inside blk_cleanup_queue()"?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block/023: performance test on queue creation & cleanup
  2018-07-25 21:33 ` Omar Sandoval
@ 2018-07-29 22:43   ` Ming Lei
  0 siblings, 0 replies; 3+ messages in thread
From: Ming Lei @ 2018-07-29 22:43 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: Omar Sandoval, Jens Axboe, linux-block

On Wed, Jul 25, 2018 at 02:33:14PM -0700, Omar Sandoval wrote:
> On Wed, Jul 04, 2018 at 01:29:56PM +0800, Ming Lei wrote:
> > SCSI may have lots of channels, targets or LUNs, so it may
> > take long time for creating and cleaning up queues.
> > 
> > So introduce block/023 and uses null_blk to run this test
> > on both blk-mq and legacy mode, then compare both and check
> > the difference.
> > 
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> >  tests/block/023     | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/block/023.out |   2 ++
> >  2 files changed, 103 insertions(+)
> >  create mode 100755 tests/block/023
> >  create mode 100755 tests/block/023.out
> 
> Hi, Ming, is this a regression test for "blk-mq: remove
> synchronize_rcu() from blk_mq_del_queue_tag_set()" and "blk-mq: avoid to
> synchronize rcu inside blk_cleanup_queue()"?

Yeah, it is.

It also shows that destroying queue may take much more time than
creating queue, and seems no solution for this one now.

Thanks,
Ming

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-29 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04  5:29 [PATCH] block/023: performance test on queue creation & cleanup Ming Lei
2018-07-25 21:33 ` Omar Sandoval
2018-07-29 22:43   ` Ming Lei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.