From ffe5c95e7eb964d38317c66ec2b77f2094cc61f1 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 17 Jul 2021 18:21:36 +0200 Subject: [PATCH] cgroup: Add io.weight example. --- content/posts/cgroup v2 by hand.adoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/content/posts/cgroup v2 by hand.adoc b/content/posts/cgroup v2 by hand.adoc index 0008e22..870a853 100644 --- a/content/posts/cgroup v2 by hand.adoc +++ b/content/posts/cgroup v2 by hand.adoc @@ -162,7 +162,7 @@ echo "$$" > cgroup.procs == Controlling Input/Output usage -This control group will limit the write speed to 2 +This control group will increase the IO priority and limit the write speed to 2 pass:[MiB] a second using the io controllerfootnote:controllers[]. IO limits are set per device. You need to specify the major and minor device numbers of the _device_ (not partition) you @@ -174,12 +174,17 @@ want to limit (in my case it is “8:0” for `/dev/sda`). Run `lsblk` or `cat echo "+io" > cgroup.subtree_control mkdir testgroup cd testgroup +echo "default 500" > io.weight echo "8:0 wbps=$((2 * 1024 * 1024)) rbps=max" > io.max echo "$$" > cgroup.procs -------------------------------------------------------------------------------- -*io.max* limits bytes per second (_rbps/wbps_) and/or IO operations per - second (_riops/wiops_). +- *io.weight* specifies the relative amount of IO time the cgroup can use in + relation to its siblings and has a range from 1 to 10,000. The priority can + be overridden for individual devices with the major:minor syntax, like “8:0 + 90”. The default is value is 100. +- *io.max* limits bytes per second (_rbps/wbps_) and/or IO operations per second + (_riops/wiops_). Try running ``dd if=/dev/zero bs=1M count=100 of=test.img oflag=direct``footnote:[`oflag=direct` opens the file with the `O_DIRECT` flag,