public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: shinichiro.kawasaki@wdc.com, linux-block@vger.kernel.org,
	yukuai3@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH RFC 1/2] tests/throtl: add a new test 007
Date: Fri, 7 Mar 2025 17:47:15 +0800	[thread overview]
Message-ID: <Z8rAo8aCwi-OWADq@fedora> (raw)
In-Reply-To: <20250307080318.3860858-2-yukuai1@huaweicloud.com>

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


  reply	other threads:[~2025-03-07  9:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z8rAo8aCwi-OWADq@fedora \
    --to=ming.lei@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=yangerkun@huawei.com \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox