[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZUhxS9JMyPK+v6Ec@fedora>
Date: Mon, 6 Nov 2023 12:53:31 +0800
From: Ming Lei <ming.lei@...hat.com>
To: Ed Tsai (蔡宗軒) <Ed.Tsai@...iatek.com>
Cc: Will Shiu (許恭瑜) <Will.Shiu@...iatek.com>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Peter Wang (王信友)
<peter.wang@...iatek.com>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
Alice Chao (趙珮均)
<Alice.Chao@...iatek.com>,
wsd_upstream <wsd_upstream@...iatek.com>,
"axboe@...nel.dk" <axboe@...nel.dk>,
Casper Li (李中榮) <casper.li@...iatek.com>,
Chun-Hung Wu (巫駿宏)
<Chun-hung.Wu@...iatek.com>,
Powen Kao (高伯文) <Powen.Kao@...iatek.com>,
Naomi Chu (朱詠田) <Naomi.Chu@...iatek.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Stanley Chu (朱原陞)
<stanley.chu@...iatek.com>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>, ming.lei@...hat.com
Subject: Re: [PATCH 1/1] block: Check the queue limit before bio submitting
On Mon, Nov 06, 2023 at 01:40:12AM +0000, Ed Tsai (蔡宗軒) wrote:
> On Mon, 2023-11-06 at 09:33 +0800, Ed Tsai wrote:
> > On Sat, 2023-11-04 at 11:43 +0800, Ming Lei wrote:
...
> Sorry for missing out on my dd command. Here it is:
> dd if=/data/test_file of=/dev/null bs=64m count=1 iflag=direct
OK, thanks for the sharing.
I understand the issue now, but not sure if it is one good idea to check
queue limit in __bio_iov_iter_get_pages():
1) bio->bi_bdev may not be set
2) what matters is actually bio's alignment, and bio size still can
be big enough
So I cooked one patch, and it should address your issue:
diff --git a/block/bio.c b/block/bio.c
index 816d412c06e9..7d982e74c65d 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1266,6 +1266,24 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
size -= trim;
}
+ /*
+ * Try to make bio aligned with 128KB if there are pages left so we
+ * can avoid small bio in case of big chunk sequential IO
+ */
+ if (iov_iter_count(iter)) {
+ unsigned curr_size = (bio->bi_iter.bi_size + size) &
+ ~((128U << 10) - 1);
+ if (curr_size <= bio->bi_iter.bi_size) {
+ ret = left = size;
+ goto revert;
+ } else {
+ curr_size -= bio->bi_iter.bi_size;
+ ret = size - curr_size;
+ iov_iter_revert(iter, ret);
+ size = curr_size;
+ }
+ }
+
if (unlikely(!size)) {
ret = -EFAULT;
goto out;
@@ -1285,7 +1303,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
offset = 0;
}
-
+revert:
iov_iter_revert(iter, left);
out:
while (i < nr_pages)
Thanks,
Ming
Powered by blists - more mailing lists