diff --git a/crun.1 b/crun.1 index 1de638e38c..f9d35d4181 100644 --- a/crun.1 +++ b/crun.1 @@ -628,19 +628,7 @@ allbox; l l l l l l l l . \fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR -weight io.bfq.weight T{ -y = (1 + (x \- 10) * 9999 / 990) -T} - T{ -convert linearly from [10\-1000] to [1\-10000] -T} -weight\_device io.bfq.weight T{ -y = (1 + (x \- 10) * 9999 / 990) -T} - T{ -convert linearly from [10\-1000] to [1\-10000] -T} -rbps io.max y=x wbps io.max y=x riops io.max y=x wiops io.max y=x +weight io.bfq.weight y = x weight\_device io.bfq.weight y = x rbps io.max y=x wbps io.max y=x riops io.max y=x wiops io.max y=x .TE .SH cpuset controller diff --git a/crun.1.md b/crun.1.md index 354b706f9f..760d981ea7 100644 --- a/crun.1.md +++ b/crun.1.md @@ -493,12 +493,12 @@ they are converted when needed from the cgroup v1 configuration. | OCI (x) | cgroup 2 value (y) | conversion | comment | |---|---|---|---| -| weight | io.bfq.weight | y = (1 + (x - 10) * 9999 / 990) | convert linearly from [10-1000] to [1-10000]| -| weight_device | io.bfq.weight | y = (1 + (x - 10) * 9999 / 990) | convert linearly from [10-1000] to [1-10000]| -|rbps|io.max|y=x|| -|wbps|io.max|y=x|| -|riops|io.max|y=x|| -|wiops|io.max|y=x|| +| weight | io.bfq.weight | y = x || +| weight_device | io.bfq.weight | y = x || +| rbps | io.max | y=x || +| wbps | io.max | y=x || +| riops | io.max |y=x || +| wiops | io.max |y=x || ## cpuset controller diff --git a/src/libcrun/cgroup.c b/src/libcrun/cgroup.c index 2a84f7c28c..ea004b7807 100644 --- a/src/libcrun/cgroup.c +++ b/src/libcrun/cgroup.c @@ -2105,16 +2105,11 @@ write_blkio_resources (int dirfd, bool cgroup2, runtime_spec_schema_config_linux char fmt_buf[128]; size_t len; int ret; - /* convert linearly from 10-1000 to 1-10000. */ -#define CONVERT_WEIGHT_TO_CGROUPS_V2(x) (1 + ((x) -10) * 9999 / 990) if (blkio->weight) { uint32_t val = blkio->weight; - if (cgroup2) - val = CONVERT_WEIGHT_TO_CGROUPS_V2 (val); - len = sprintf (fmt_buf, "%" PRIu32, val); ret = write_file_at (dirfd, cgroup2 ? "io.bfq.weight" : "blkio.weight", fmt_buf, len, err); if (UNLIKELY (ret < 0)) @@ -2141,7 +2136,7 @@ write_blkio_resources (int dirfd, bool cgroup2, runtime_spec_schema_config_linux return crun_make_error (err, errno, "open io.weight"); for (i = 0; i < blkio->weight_device_len; i++) { - uint32_t w = CONVERT_WEIGHT_TO_CGROUPS_V2 (blkio->weight_device[i]->weight); + uint32_t w = blkio->weight_device[i]->weight; len = sprintf (fmt_buf, "%" PRIu64 ":%" PRIu64 " %i\n", blkio->weight_device[i]->major, blkio->weight_device[i]->minor, w);