All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: linux-block@vger.kernel.org
Cc: yukuai3@huawei.com, shinichiro.kawasaki@wdc.com,
	yi.zhang@redhat.com, bvanassche@acm.org, gjoyce@ibm.com
Subject: [PATCHv2 blktests 1/2] throtl/002: calculate block-size based on device max-sectors setting
Date: Wed, 18 Dec 2024 19:13:21 +0530	[thread overview]
Message-ID: <20241218134326.2164105-2-nilay@linux.ibm.com> (raw)
In-Reply-To: <20241218134326.2164105-1-nilay@linux.ibm.com>

The commit 60fa2e3ff3ab ("update max_sectors setting") added max-sectors
while setting up throttle device. So now we should also calculate block-
size which matches the wiops. Typically, size of each IO which is submitted
to the block device depends on the max-sectors setting of the block device.
For example setting max-sectors to 128 results into 64kb of max. IO size
which should be used for sending read/write command to the device. So take
into account the max-sectors-kb and wiops settings and calculate the
appropriate block-size which is then used to issue IO to the block device.
This change would result in always submitting 256 I/O read/write commands
to block device.

Without this change on a system with 64k PAGE SIZE, using block-size of 1M
would result in 16 I/O being submitted to the device and this operation may
finish in a fraction of a section and result in test failure. However the
intent of this test case is that we want to test submitting 256 I/O after
setting wiops limit to 256.

Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
---
 tests/throtl/002 | 14 ++++++++++----
 tests/throtl/rc  |  4 ++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/tests/throtl/002 b/tests/throtl/002
index 185e66b..02b0969 100755
--- a/tests/throtl/002
+++ b/tests/throtl/002
@@ -14,6 +14,9 @@ test() {
 	echo "Running ${TEST_NAME}"
 
 	local page_size max_secs
+	local io_size_kb block_size
+	local iops=256
+
 	page_size=$(getconf PAGE_SIZE)
 	max_secs=$((page_size / 512))
 
@@ -21,12 +24,15 @@ test() {
 		return 1;
 	fi
 
-	_throtl_set_limits wiops=256
-	_throtl_test_io write 1M 1
+	io_size_kb=$(($(_throtl_get_max_io_size) * 1024))
+	block_size=$((iops * io_size_kb))
+
+	_throtl_set_limits wiops="${iops}"
+	_throtl_test_io write "${block_size}" 1
 	_throtl_remove_limits
 
-	_throtl_set_limits riops=256
-	_throtl_test_io read 1M 1
+	_throtl_set_limits riops="${iops}"
+	_throtl_test_io read "${block_size}" 1
 	_throtl_remove_limits
 
 	_clean_up_throtl
diff --git a/tests/throtl/rc b/tests/throtl/rc
index 9c264bd..330e6b9 100644
--- a/tests/throtl/rc
+++ b/tests/throtl/rc
@@ -71,6 +71,10 @@ _throtl_remove_limits() {
 		"$CGROUP2_DIR/$THROTL_DIR/io.max"
 }
 
+_throtl_get_max_io_size() {
+	cat "/sys/block/$THROTL_DEV/queue/max_sectors_kb"
+}
+
 _throtl_issue_io() {
 	local start_time
 	local end_time
-- 
2.45.2


  reply	other threads:[~2024-12-18 13:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 13:43 [PATCHv2 blktests 0/2] throtl: fix IO block-size and race while submitting IO Nilay Shroff
2024-12-18 13:43 ` Nilay Shroff [this message]
2024-12-26  7:30   ` [PATCHv2 blktests 1/2] throtl/002: calculate block-size based on device max-sectors setting Yi Zhang
2024-12-18 13:43 ` [PATCHv2 blktests 2/2] throtl: fix the race between submitting IO and setting cgroup.procs Nilay Shroff
2024-12-25  2:55   ` Yu Kuai
2024-12-24  8:26 ` [PATCHv2 blktests 0/2] throtl: fix IO block-size and race while submitting IO Shinichiro Kawasaki
2025-01-16 11:22   ` Nilay Shroff
2025-01-17  0:35     ` 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=20241218134326.2164105-2-nilay@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=bvanassche@acm.org \
    --cc=gjoyce@ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=yi.zhang@redhat.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 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.