Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions crun.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions crun.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 1 addition & 6 deletions src/libcrun/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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);
Expand Down