linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai1@huaweicloud.com>
To: Lance Yang <ioworker0@gmail.com>, yukuai1@huaweicloud.com
Cc: 21cnbao@gmail.com, a.hindborg@samsung.com, axboe@kernel.dk,
	baolin.wang@linux.alibaba.com, boqun.feng@gmail.com,
	cgroups@vger.kernel.org, david@redhat.com,
	fujita.tomonori@lab.ntt.co.jp, josef@toxicpanda.com,
	libang.li@antgroup.com, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	mkoutny@suse.com, paolo.valente@unimore.it, tj@kernel.org,
	vbabka@kernel.org, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [BUG] cgroupv2/blk: inconsistent I/O behavior in Cgroup v2 with set device wbps and wiops
Date: Mon, 26 Aug 2024 09:31:48 +0800	[thread overview]
Message-ID: <36c4744a-3827-f6d7-664a-8ee2b7d0e281@huaweicloud.com> (raw)
In-Reply-To: <20240823120510.61853-1-ioworker0@gmail.com>

Hi,

在 2024/08/23 20:05, Lance Yang 写道:
> My bad, I got tied up with some stuff :(
> 
> Hmm... tried your debug patch today, but my test results are different from
> yours. So let's take a look at direct IO with raw disk first.
> 
> ```
> $ lsblk
> NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
> sda      8:0    0   90G  0 disk
> ├─sda1   8:1    0    1G  0 part /boot/efi
> └─sda2   8:2    0 88.9G  0 part /
> sdb      8:16   0   10G  0 disk
> 
> $ cat  /sys/block/sda/queue/scheduler
> none [mq-deadline]
> 
> $ cat  /sys/block/sda/queue/rotational
> 0
> 
> $ cat  /sys/block/sdb/queue/rotational
> 0
> 
> $ cat  /sys/block/sdb/queue/scheduler
> none [mq-deadline]
> 
> $ cat /boot/config-6.11.0-rc3+ |grep CONFIG_CGROUP_
> # CONFIG_CGROUP_FAVOR_DYNMODS is not set
> CONFIG_CGROUP_WRITEBACK=y
> CONFIG_CGROUP_SCHED=y
> CONFIG_CGROUP_PIDS=y
> CONFIG_CGROUP_RDMA=y
> CONFIG_CGROUP_FREEZER=y
> CONFIG_CGROUP_HUGETLB=y
> CONFIG_CGROUP_DEVICE=y
> CONFIG_CGROUP_CPUACCT=y
> CONFIG_CGROUP_PERF=y
> CONFIG_CGROUP_BPF=y
> CONFIG_CGROUP_MISC=y
> # CONFIG_CGROUP_DEBUG is not set
> CONFIG_CGROUP_NET_PRIO=y
> CONFIG_CGROUP_NET_CLASSID=y
> 
> $ cd /sys/fs/cgroup/test/ && cat cgroup.controllers
> cpu io memory pids
> 
> $ cat io.weight
> default 100
> 
> $ cat io.prio.class
> no-change
> ```
> 
> With wiops, the result is as follows:
> 
> ```
> $ echo "8:16 wbps=10485760 wiops=100000" > io.max
> 
> $ dd if=/dev/zero of=/dev/sdb bs=50M count=1 oflag=direct
> 1+0 records in
> 1+0 records out
> 52428800 bytes (52 MB, 50 MiB) copied, 5.05893 s, 10.4 MB/s
> 
> $ dmesg -T
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 2984 ffff0000fb3a8f00
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 6176 ffff0000fb3a97c0
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 7224 ffff0000fb3a9180
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a8640
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a9400
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a8c80
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a9040
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a92c0
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 4096 ffff0000fb3a8000

> 
> And without wiops, the result is quite different:
> 
> ```
> $ echo "8:16 wbps=10485760 wiops=max" > io.max
> 
> $ dd if=/dev/zero of=/dev/sdb bs=50M count=1 oflag=direct
> 1+0 records in
> 1+0 records out
> 52428800 bytes (52 MB, 50 MiB) copied, 5.08187 s, 10.3 MB/s
> 
> $ dmesg -T
> [Fri Aug 23 10:59:10 2024] __blk_throtl_bio: bio start 2880 ffff0000c74659c0
> [Fri Aug 23 10:59:10 2024] __blk_throtl_bio: bio start 6992 ffff00014f621b80
> [Fri Aug 23 10:59:10 2024] __blk_throtl_bio: bio start 92528 ffff00014f620dc0

I don't know why IO size from fs layer is different in this case.

> ```
> 
> Then, I retested for ext4 as you did.
> 
> ```
> $ lsblk
> NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
> sda      8:0    0   90G  0 disk
> ├─sda1   8:1    0    1G  0 part /boot/efi
> └─sda2   8:2    0 88.9G  0 part /
> sdb      8:16   0   10G  0 disk
> 
> $ df -T /data
> Filesystem     Type 1K-blocks     Used Available Use% Mounted on
> /dev/sda2      ext4  91222760 54648704  31894224  64% /
> ```
> 
> With wiops, the result is as follows:
> 
> ```
> $ echo "8:0 wbps=10485760 wiops=100000" > io.max
> 
> $ rm -rf /data/file1 && dd if=/dev/zero of=/data/file1 bs=50M count=1 oflag=direct
> 1+0 records in
> 1+0 records out
> 52428800 bytes (52 MB, 50 MiB) copied, 5.06227 s, 10.4 MB/s
> 
> $ dmesg -T
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 2984 ffff0000fb3a8f00
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 6176 ffff0000fb3a97c0
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 7224 ffff0000fb3a9180
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a8640
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a9400
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a8c80
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a9040
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 16384 ffff0000fb3a92c0
> [Fri Aug 23 11:04:08 2024] __blk_throtl_bio: bio start 4096 ffff0000fb3a8000

> 
> And without wiops, the result is also quite different:
> 
> ```
> $ echo "8:0 wbps=10485760 wiops=max" > io.max
> 
> $ rm -rf /data/file1 && dd if=/dev/zero of=/data/file1 bs=50M count=1 oflag=direct
> 1+0 records in
> 1+0 records out
> 52428800 bytes (52 MB, 50 MiB) copied, 5.03759 s, 10.4 MB/s
> 
> $ dmesg -T
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 2904 ffff0000c4e9f2c0
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 5984 ffff0000c4e9e000
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 7496 ffff0000c4e9e3c0
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 16384 ffff0000c4e9eb40
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 16384 ffff0000c4e9f540
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 16384 ffff0000c4e9e780
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 16384 ffff0000c4e9ea00
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 16384 ffff0000c4e9f900
> [Fri Aug 23 11:05:07 2024] __blk_throtl_bio: bio start 4096 ffff0000c4e9e8c0

While ext4 is the same. And I won't say result is different here.
> [
> ```
> 
> Hmm... I still hava two questions here:
> 1. Is wbps an average value?

Yes.
> 2. What's the difference between setting 'max' and setting a very high value for 'wiops'?

The only difference is that:

- If there is no iops limit, splited IO will be dispatched directly;
- If there is iops limit, splited IO will be throttled again. iops is
high, however, blk-throtl is FIFO, splited IO will have to wait for
formal request to be throttled by bps first before checking the iops
limit for splited IO.

Thanks,
Kuai

> 
> Thanks a lot again for your time!
> Lance
> .
> 



  reply	other threads:[~2024-08-26  1:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 15:00 Lance Yang
2024-08-12 15:43 ` Michal Koutný
2024-08-13  1:37   ` Yu Kuai
2024-08-13  5:00     ` Lance Yang
2024-08-13  6:17       ` Lance Yang
2024-08-13  6:39       ` Yu Kuai
2024-08-13  7:19         ` Yu Kuai
2024-08-15  1:59           ` Lance Yang
2024-08-23 12:05           ` Lance Yang
2024-08-26  1:31             ` Yu Kuai [this message]
2024-08-26  2:15               ` Lance Yang
2024-08-23 12:19           ` Lance Yang
2024-08-13  5:11   ` Lance Yang

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=36c4744a-3827-f6d7-664a-8ee2b7d0e281@huaweicloud.com \
    --to=yukuai1@huaweicloud.com \
    --cc=21cnbao@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=boqun.feng@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=david@redhat.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=ioworker0@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=libang.li@antgroup.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mkoutny@suse.com \
    --cc=paolo.valente@unimore.it \
    --cc=tj@kernel.org \
    --cc=vbabka@kernel.org \
    --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