linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block/021: test setting 'nr_requests'
@ 2018-06-02  5:02 Ming Lei
  2018-06-11 20:40 ` Omar Sandoval
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2018-06-02  5:02 UTC (permalink / raw)
  To: Omar Sandoval
  Cc: Jens Axboe, linux-block, Ming Lei, Marco Patalano, Ewan D. Milne

'nr_requests' can be a bit different for 'none' scheduler,
and especially current blk-mq can only decrease this value
for 'none.'

The patch of 'blk-mq: fix read/write 'nr_requests' in case of 'none' scheduler'
has been sent out for fixing this issue.

Cc: Marco Patalano <mpatalan@redhat.com>
Cc: "Ewan D. Milne" <emilne@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 tests/block/021     | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/block/021.out |  2 ++
 2 files changed, 53 insertions(+)
 create mode 100755 tests/block/021
 create mode 100755 tests/block/021.out

diff --git a/tests/block/021 b/tests/block/021
new file mode 100755
index 000000000000..b72d9bd8b41d
--- /dev/null
+++ b/tests/block/021
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# Test blk-mq request allocation when hardware tags are limited. Regression
+# test for commit e6fc46498784 ("blk-mq: avoid starving tag allocation after
+# allocating process migrates").
+#
+# Copyright (C) 2018 Ming Lei <ming.lei@redhat.com>
+#
+# 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/>.
+
+DESCRIPTION="read/write nr_requests on null-blk with different scheduler"
+QUICK=1
+
+requires() {
+	_have_module null_blk
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe -r null_blk
+	modprobe null_blk
+
+	local scheds
+	# shellcheck disable=SC2207
+	scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
+
+	for sched in "${scheds[@]}"; do
+		echo "Testing $sched" >> "$FULL"
+		echo "$sched" > /sys/block/nullb0/queue/scheduler
+		max_nr=`cat /sys/block/nullb0/queue/nr_requests`
+		for nr in `seq 4 $max_nr`; do
+			echo $nr > /sys/block/nullb0/queue/nr_requests
+		done
+	done
+
+	modprobe -r null_blk
+
+	echo "Test complete"
+}
diff --git a/tests/block/021.out b/tests/block/021.out
new file mode 100755
index 000000000000..3a397c5c8ff5
--- /dev/null
+++ b/tests/block/021.out
@@ -0,0 +1,2 @@
+Running block/021
+Test complete
-- 
2.9.5

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

* Re: [PATCH] block/021: test setting 'nr_requests'
  2018-06-02  5:02 [PATCH] block/021: test setting 'nr_requests' Ming Lei
@ 2018-06-11 20:40 ` Omar Sandoval
  0 siblings, 0 replies; 2+ messages in thread
From: Omar Sandoval @ 2018-06-11 20:40 UTC (permalink / raw)
  To: Ming Lei
  Cc: Omar Sandoval, Jens Axboe, linux-block, Marco Patalano,
	Ewan D. Milne

On Sat, Jun 02, 2018 at 01:02:04PM +0800, Ming Lei wrote:
> 'nr_requests' can be a bit different for 'none' scheduler,
> and especially current blk-mq can only decrease this value
> for 'none.'
> 
> The patch of 'blk-mq: fix read/write 'nr_requests' in case of 'none' scheduler'
> has been sent out for fixing this issue.

Applied with a couple of fixes mentioned below.

> Cc: Marco Patalano <mpatalan@redhat.com>
> Cc: "Ewan D. Milne" <emilne@redhat.com>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
>  tests/block/021     | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/block/021.out |  2 ++
>  2 files changed, 53 insertions(+)
>  create mode 100755 tests/block/021
>  create mode 100755 tests/block/021.out
> 
> diff --git a/tests/block/021 b/tests/block/021
> new file mode 100755
> index 000000000000..b72d9bd8b41d
> --- /dev/null
> +++ b/tests/block/021
> @@ -0,0 +1,51 @@
> +#!/bin/bash
> +#
> +# Test blk-mq request allocation when hardware tags are limited. Regression
> +# test for commit e6fc46498784 ("blk-mq: avoid starving tag allocation after
> +# allocating process migrates").

This wasn't updated for this test. I fixed it.

> +# Copyright (C) 2018 Ming Lei <ming.lei@redhat.com>
> +#
> +# 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/>.
> +
> +DESCRIPTION="read/write nr_requests on null-blk with different scheduler"
> +QUICK=1
> +
> +requires() {
> +	_have_module null_blk
> +}
> +
> +test() {
> +	echo "Running ${TEST_NAME}"
> +
> +	modprobe -r null_blk
> +	modprobe null_blk
> +
> +	local scheds
> +	# shellcheck disable=SC2207
> +	scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
> +
> +	for sched in "${scheds[@]}"; do
> +		echo "Testing $sched" >> "$FULL"
> +		echo "$sched" > /sys/block/nullb0/queue/scheduler
> +		max_nr=`cat /sys/block/nullb0/queue/nr_requests`

I changed this to the preferred $() style command substitution.

> +		for nr in `seq 4 $max_nr`; do

I changed this to the preferred bash for loop syntax.

> +			echo $nr > /sys/block/nullb0/queue/nr_requests
> +		done
> +	done
> +
> +	modprobe -r null_blk
> +
> +	echo "Test complete"
> +}
> diff --git a/tests/block/021.out b/tests/block/021.out
> new file mode 100755
> index 000000000000..3a397c5c8ff5
> --- /dev/null
> +++ b/tests/block/021.out
> @@ -0,0 +1,2 @@
> +Running block/021
> +Test complete
> -- 
> 2.9.5
> 

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

end of thread, other threads:[~2018-06-11 20:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-02  5:02 [PATCH] block/021: test setting 'nr_requests' Ming Lei
2018-06-11 20:40 ` Omar Sandoval

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).