* [PATCH RFC 0/2] tests/throtl: add two regression tests
@ 2025-03-07 8:03 Yu Kuai
2025-03-07 8:03 ` [PATCH RFC 1/2] tests/throtl: add a new test 007 Yu Kuai
2025-03-07 8:03 ` [PATCH RFC 2/2] tests/throtl: add a new test 008 Yu Kuai
0 siblings, 2 replies; 7+ messages in thread
From: Yu Kuai @ 2025-03-07 8:03 UTC (permalink / raw)
To: shinichiro.kawasaki, ming.lei, linux-block; +Cc: yukuai3, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
Yu Kuai (2):
tests/throtl: add a new test 007
tests/throtl: add a new test 008
tests/throtl/007 | 65 ++++++++++++++++++++++++++++++++++++++++++++
tests/throtl/007.out | 4 +++
tests/throtl/008 | 39 ++++++++++++++++++++++++++
tests/throtl/008.out | 6 ++++
4 files changed, 114 insertions(+)
create mode 100755 tests/throtl/007
create mode 100644 tests/throtl/007.out
create mode 100755 tests/throtl/008
create mode 100644 tests/throtl/008.out
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH RFC 1/2] tests/throtl: add a new test 007
2025-03-07 8:03 [PATCH RFC 0/2] tests/throtl: add two regression tests Yu Kuai
@ 2025-03-07 8:03 ` Yu Kuai
2025-03-07 9:47 ` Ming Lei
2025-03-12 2:36 ` Shinichiro Kawasaki
2025-03-07 8:03 ` [PATCH RFC 2/2] tests/throtl: add a new test 008 Yu Kuai
1 sibling, 2 replies; 7+ messages in thread
From: Yu Kuai @ 2025-03-07 8:03 UTC (permalink / raw)
To: shinichiro.kawasaki, ming.lei, linux-block; +Cc: yukuai3, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
Add test for IO merge over iops limit.
Noted this test will fail for now, kernel solution is in development.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
tests/throtl/007 | 65 ++++++++++++++++++++++++++++++++++++++++++++
tests/throtl/007.out | 4 +++
2 files changed, 69 insertions(+)
create mode 100755 tests/throtl/007
create mode 100644 tests/throtl/007.out
diff --git a/tests/throtl/007 b/tests/throtl/007
new file mode 100755
index 0000000..597f879
--- /dev/null
+++ b/tests/throtl/007
@@ -0,0 +1,65 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Yu Kuai
+#
+# Test iops limit over io merge
+
+. tests/throtl/rc
+
+DESCRIPTION="basic functionality"
+QUICK=1
+
+requires() {
+ _have_program taskset
+ _have_program fio
+}
+
+# every 16 0.5k IO will merge into one 8k IO, ideally runtime is 1s,
+# however it's about 1.3s in practice
+__fio() {
+ taskset -c 0 \
+ fio -filename=/dev/$THROTL_DEV \
+ -name=test \
+ -size=1600k \
+ -rw=write \
+ -bs=512 \
+ -iodepth=32 \
+ -iodepth_low=16 \
+ -iodepth_batch=16 \
+ -numjobs=1 \
+ -direct=1 \
+ -ioengine=io_uring &> /dev/null
+}
+
+test_io() {
+ start_time=$(date +%s.%N)
+
+ {
+ echo "$BASHPID" > "$CGROUP2_DIR/$THROTL_DIR/cgroup.procs"
+ __fio
+ } &
+
+ wait $!
+ end_time=$(date +%s.%N)
+ elapsed=$(echo "$end_time - $start_time" | bc)
+ printf "%.0f\n" "$elapsed"
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ # iolatency is 10ms, iops is at most 200/s
+ if ! _set_up_throtl irqmode=2 completion_nsec=10000000 hw_queue_depth=2; then
+ return 1;
+ fi
+
+ test_io
+
+ # 300 means 50% error range, no IO should be throttled
+ _throtl_set_limits wiops=300
+ test_io
+ _throtl_remove_limits
+
+ _clean_up_throtl
+ echo "Test complete"
+}
diff --git a/tests/throtl/007.out b/tests/throtl/007.out
new file mode 100644
index 0000000..0d568ef
--- /dev/null
+++ b/tests/throtl/007.out
@@ -0,0 +1,4 @@
+Running throtl/007
+1
+1
+Test complete
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH RFC 2/2] tests/throtl: add a new test 008
2025-03-07 8:03 [PATCH RFC 0/2] tests/throtl: add two regression tests Yu Kuai
2025-03-07 8:03 ` [PATCH RFC 1/2] tests/throtl: add a new test 007 Yu Kuai
@ 2025-03-07 8:03 ` Yu Kuai
2025-03-12 2:37 ` Shinichiro Kawasaki
1 sibling, 1 reply; 7+ messages in thread
From: Yu Kuai @ 2025-03-07 8:03 UTC (permalink / raw)
To: shinichiro.kawasaki, ming.lei, linux-block; +Cc: yukuai3, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
Test that a high iops limit won't affect bps limit.
Noted this test will fail for now, kernel solution is in development.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
tests/throtl/008 | 39 +++++++++++++++++++++++++++++++++++++++
tests/throtl/008.out | 6 ++++++
2 files changed, 45 insertions(+)
create mode 100755 tests/throtl/008
create mode 100644 tests/throtl/008.out
diff --git a/tests/throtl/008 b/tests/throtl/008
new file mode 100755
index 0000000..c64f427
--- /dev/null
+++ b/tests/throtl/008
@@ -0,0 +1,39 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2024 Yu Kuai
+#
+# Test bps limit with iops limit over io split
+
+. tests/throtl/rc
+
+DESCRIPTION="bps limit with iops limit over io split"
+QUICK=1
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ if ! _set_up_throtl max_sectors=8; then
+ return 1;
+ fi
+
+ local bps_limit=$((1024 * 1024))
+ local iops_limit=1000000
+
+ # just set bps limit first
+ _throtl_set_limits wbps=$bps_limit
+ _throtl_test_io write 1M 1 &
+ _throtl_test_io write 1M 1 &
+ wait
+ _throtl_remove_limits
+
+ # set the same bps limit and a high iops limit
+ # should behave the same as no iops limit
+ _throtl_set_limits wbps=$bps_limit wiops=$iops_limit
+ _throtl_test_io write 1M 1 &
+ _throtl_test_io write 1M 1 &
+ wait
+ _throtl_remove_limits
+
+ _clean_up_throtl
+ echo "Test complete"
+}
diff --git a/tests/throtl/008.out b/tests/throtl/008.out
new file mode 100644
index 0000000..72f4db1
--- /dev/null
+++ b/tests/throtl/008.out
@@ -0,0 +1,6 @@
+Running throtl/008
+1
+2
+1
+2
+Test complete
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 1/2] tests/throtl: add a new test 007
2025-03-07 8:03 ` [PATCH RFC 1/2] tests/throtl: add a new test 007 Yu Kuai
@ 2025-03-07 9:47 ` Ming Lei
2025-03-10 1:43 ` Yu Kuai
2025-03-12 2:36 ` Shinichiro Kawasaki
1 sibling, 1 reply; 7+ messages in thread
From: Ming Lei @ 2025-03-07 9:47 UTC (permalink / raw)
To: Yu Kuai; +Cc: shinichiro.kawasaki, linux-block, yukuai3, yangerkun
On Fri, Mar 07, 2025 at 04:03:17PM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
>
> Add test for IO merge over iops limit.
>
> Noted this test will fail for now, kernel solution is in development.
>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> tests/throtl/007 | 65 ++++++++++++++++++++++++++++++++++++++++++++
> tests/throtl/007.out | 4 +++
> 2 files changed, 69 insertions(+)
> create mode 100755 tests/throtl/007
> create mode 100644 tests/throtl/007.out
>
> diff --git a/tests/throtl/007 b/tests/throtl/007
> new file mode 100755
> index 0000000..597f879
> --- /dev/null
> +++ b/tests/throtl/007
> @@ -0,0 +1,65 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2025 Yu Kuai
> +#
> +# Test iops limit over io merge
> +
> +. tests/throtl/rc
> +
> +DESCRIPTION="basic functionality"
> +QUICK=1
> +
> +requires() {
> + _have_program taskset
> + _have_program fio
> +}
> +
> +# every 16 0.5k IO will merge into one 8k IO, ideally runtime is 1s,
> +# however it's about 1.3s in practice
> +__fio() {
> + taskset -c 0 \
> + fio -filename=/dev/$THROTL_DEV \
> + -name=test \
> + -size=1600k \
> + -rw=write \
> + -bs=512 \
> + -iodepth=32 \
> + -iodepth_low=16 \
> + -iodepth_batch=16 \
> + -numjobs=1 \
> + -direct=1 \
> + -ioengine=io_uring &> /dev/null
> +}
> +
> +test_io() {
> + start_time=$(date +%s.%N)
> +
> + {
> + echo "$BASHPID" > "$CGROUP2_DIR/$THROTL_DIR/cgroup.procs"
> + __fio
> + } &
> +
> + wait $!
> + end_time=$(date +%s.%N)
> + elapsed=$(echo "$end_time - $start_time" | bc)
> + printf "%.0f\n" "$elapsed"
> +}
> +
> +test() {
> + echo "Running ${TEST_NAME}"
> +
> + # iolatency is 10ms, iops is at most 200/s
> + if ! _set_up_throtl irqmode=2 completion_nsec=10000000 hw_queue_depth=2; then
> + return 1;
> + fi
> +
> + test_io
> +
> + # 300 means 50% error range, no IO should be throttled
> + _throtl_set_limits wiops=300
> + test_io
> + _throtl_remove_limits
> +
> + _clean_up_throtl
> + echo "Test complete"
> +}
> diff --git a/tests/throtl/007.out b/tests/throtl/007.out
> new file mode 100644
> index 0000000..0d568ef
> --- /dev/null
> +++ b/tests/throtl/007.out
> @@ -0,0 +1,4 @@
> +Running throtl/007
> +1
> +1
> +Test complete
I'd suggest to check if actual iops matches with the iops limit directly,
and it isn't intuitive to compare time taken in test wrt. iops throttle.
Thanks,
Ming
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 1/2] tests/throtl: add a new test 007
2025-03-07 9:47 ` Ming Lei
@ 2025-03-10 1:43 ` Yu Kuai
0 siblings, 0 replies; 7+ messages in thread
From: Yu Kuai @ 2025-03-10 1:43 UTC (permalink / raw)
To: Ming Lei, Yu Kuai; +Cc: shinichiro.kawasaki, linux-block, yangerkun, yukuai (C)
Hi,
在 2025/03/07 17:47, Ming Lei 写道:
> On Fri, Mar 07, 2025 at 04:03:17PM +0800, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@huawei.com>
>>
>> Add test for IO merge over iops limit.
>>
>> Noted this test will fail for now, kernel solution is in development.
>>
>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>> ---
>> tests/throtl/007 | 65 ++++++++++++++++++++++++++++++++++++++++++++
>> tests/throtl/007.out | 4 +++
>> 2 files changed, 69 insertions(+)
>> create mode 100755 tests/throtl/007
>> create mode 100644 tests/throtl/007.out
>>
>> diff --git a/tests/throtl/007 b/tests/throtl/007
>> new file mode 100755
>> index 0000000..597f879
>> --- /dev/null
>> +++ b/tests/throtl/007
>> @@ -0,0 +1,65 @@
>> +#!/bin/bash
>> +# SPDX-License-Identifier: GPL-3.0+
>> +# Copyright (C) 2025 Yu Kuai
>> +#
>> +# Test iops limit over io merge
>> +
>> +. tests/throtl/rc
>> +
>> +DESCRIPTION="basic functionality"
>> +QUICK=1
>> +
>> +requires() {
>> + _have_program taskset
>> + _have_program fio
>> +}
>> +
>> +# every 16 0.5k IO will merge into one 8k IO, ideally runtime is 1s,
>> +# however it's about 1.3s in practice
>> +__fio() {
>> + taskset -c 0 \
>> + fio -filename=/dev/$THROTL_DEV \
>> + -name=test \
>> + -size=1600k \
>> + -rw=write \
>> + -bs=512 \
>> + -iodepth=32 \
>> + -iodepth_low=16 \
>> + -iodepth_batch=16 \
>> + -numjobs=1 \
>> + -direct=1 \
>> + -ioengine=io_uring &> /dev/null
>> +}
>> +
>> +test_io() {
>> + start_time=$(date +%s.%N)
>> +
>> + {
>> + echo "$BASHPID" > "$CGROUP2_DIR/$THROTL_DIR/cgroup.procs"
>> + __fio
>> + } &
>> +
>> + wait $!
>> + end_time=$(date +%s.%N)
>> + elapsed=$(echo "$end_time - $start_time" | bc)
>> + printf "%.0f\n" "$elapsed"
>> +}
>> +
>> +test() {
>> + echo "Running ${TEST_NAME}"
>> +
>> + # iolatency is 10ms, iops is at most 200/s
>> + if ! _set_up_throtl irqmode=2 completion_nsec=10000000 hw_queue_depth=2; then
>> + return 1;
>> + fi
>> +
>> + test_io
>> +
>> + # 300 means 50% error range, no IO should be throttled
>> + _throtl_set_limits wiops=300
>> + test_io
>> + _throtl_remove_limits
>> +
>> + _clean_up_throtl
>> + echo "Test complete"
>> +}
>> diff --git a/tests/throtl/007.out b/tests/throtl/007.out
>> new file mode 100644
>> index 0000000..0d568ef
>> --- /dev/null
>> +++ b/tests/throtl/007.out
>> @@ -0,0 +1,4 @@
>> +Running throtl/007
>> +1
>> +1
>> +Test complete
>
> I'd suggest to check if actual iops matches with the iops limit directly,
> and it isn't intuitive to compare time taken in test wrt. iops throttle.
Yes, that's a good idea.
BTW, I'll wait if we agree with the change in kernel first before
sending the next version.
Thanks,
Kuai
>
> Thanks,
> Ming
>
>
> .
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 1/2] tests/throtl: add a new test 007
2025-03-07 8:03 ` [PATCH RFC 1/2] tests/throtl: add a new test 007 Yu Kuai
2025-03-07 9:47 ` Ming Lei
@ 2025-03-12 2:36 ` Shinichiro Kawasaki
1 sibling, 0 replies; 7+ messages in thread
From: Shinichiro Kawasaki @ 2025-03-12 2:36 UTC (permalink / raw)
To: Yu Kuai
Cc: ming.lei@redhat.com, linux-block@vger.kernel.org,
yukuai3@huawei.com, yangerkun@huawei.com
On Mar 07, 2025 / 16:03, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
>
> Add test for IO merge over iops limit.
>
> Noted this test will fail for now, kernel solution is in development.
Thanks Yu. I will add nit comments below. I will do review again and trial runs
when the kernel solution gets available.
>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> tests/throtl/007 | 65 ++++++++++++++++++++++++++++++++++++++++++++
> tests/throtl/007.out | 4 +++
> 2 files changed, 69 insertions(+)
> create mode 100755 tests/throtl/007
> create mode 100644 tests/throtl/007.out
>
> diff --git a/tests/throtl/007 b/tests/throtl/007
> new file mode 100755
> index 0000000..597f879
> --- /dev/null
> +++ b/tests/throtl/007
> @@ -0,0 +1,65 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2025 Yu Kuai
> +#
> +# Test iops limit over io merge
> +
> +. tests/throtl/rc
> +
> +DESCRIPTION="basic functionality"
I expect this will be updated
> +QUICK=1
> +
> +requires() {
> + _have_program taskset
This line is not necessary. taskset is included in util-linux, which the "check"
script confirms avialability.
> + _have_program fio
I recommend _have_fio instead.
> +}
> +
> +# every 16 0.5k IO will merge into one 8k IO, ideally runtime is 1s,
> +# however it's about 1.3s in practice
> +__fio() {
I guess you will think about better name of this function here. "run_fio" or
something? It's the better to not have underscore prefix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 2/2] tests/throtl: add a new test 008
2025-03-07 8:03 ` [PATCH RFC 2/2] tests/throtl: add a new test 008 Yu Kuai
@ 2025-03-12 2:37 ` Shinichiro Kawasaki
0 siblings, 0 replies; 7+ messages in thread
From: Shinichiro Kawasaki @ 2025-03-12 2:37 UTC (permalink / raw)
To: Yu Kuai
Cc: ming.lei@redhat.com, linux-block@vger.kernel.org,
yukuai3@huawei.com, yangerkun@huawei.com
On Mar 07, 2025 / 16:03, Yu Kuai wrote:
...
> diff --git a/tests/throtl/008 b/tests/throtl/008
> new file mode 100755
> index 0000000..c64f427
> --- /dev/null
> +++ b/tests/throtl/008
> @@ -0,0 +1,39 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2024 Yu Kuai
Nit: I guess you may want to update the year to 2025.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-03-12 2:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 8:03 [PATCH RFC 0/2] tests/throtl: add two regression tests Yu Kuai
2025-03-07 8:03 ` [PATCH RFC 1/2] tests/throtl: add a new test 007 Yu Kuai
2025-03-07 9:47 ` Ming Lei
2025-03-10 1:43 ` Yu Kuai
2025-03-12 2:36 ` Shinichiro Kawasaki
2025-03-07 8:03 ` [PATCH RFC 2/2] tests/throtl: add a new test 008 Yu Kuai
2025-03-12 2:37 ` Shinichiro Kawasaki
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).