Skip to content

Conversation

@runcom
Copy link
Member

@runcom runcom commented Sep 16, 2015

WeightDevice, ThrottleReadBpsDevice, ThrottleWriteBpsDevice, ThrottleReadIOpsDevice, ThrottleWriteIOpsDevice are now slices to well defined structs to allow setting multiple devices in their respective blkio file. By using a string to represents those values it wasn't possible to set correct values when multiple devices were passed in the config (either newline separated or comma separated).

I don't know how this worked before to define multiple devices for these cgroups resources. Writing something like 8:0 500\n8:16 300 isn't working (there's a Docker PR moby/moby#13959 which passes that format to libcontainer and by passing that format to current master runc isn't working as well (neither using comma) because it just writes it to cgroup file which doesn't accept newlines/commas).
8:0 500\n8:16 300 will only set the first device before the \n when written to blkio.weight_device for instance.

I'm not fond of blockIODevice embedded struct and specifying major:minor for this. I think it will suffice specifying just a Path and do the syscall.Stat to retrieve major:minor where it needs to (I'm thinking about libcontainer as it's currently doing for Rlimits for instance).
By just specifing a Path this will help also for example to just receive a string like /dev/sda and do the major:minor convert in the implementation. It's useful to have the plain string like for checking which scheduler the device is using (/sys/block/sda/queue/scheduler w/o converting back major:minor to path in implementation).

I'll open an issue in runc to track this and update runc/libcontainer if this patch is correct and lands.

Signed-off-by: Antonio Murdaca [email protected]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There doesn't seem to be much point in having these examples if they're all null. Maybe drop some of them completely, and then set the remaining ones to something more useful to show the new syntax?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it as it was but yes makes sense I'll update the example

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@wking
Copy link
Contributor

wking commented Sep 16, 2015

On Wed, Sep 16, 2015 at 07:51:53AM -0700, Antonio Murdaca wrote:

I'm not fond of blockIODevice embedded struct and specifying
major:minor for this. I think it will suffice specifying just a
Path and do the syscall.Stat to retrieve major:minor where it
needs to (I'm thinking about libcontainer as it's currently doing
for Rlimits for instance).

I'm fine with blockIODevice. One benefit is that we don't need to
specify ordering between mounting, mknod calls, and these resource
limits, because we can set major:minor limits before the path exists.

@runcom
Copy link
Member Author

runcom commented Sep 16, 2015

On Wed, Sep 16, 2015 at 07:51:53AM -0700, Antonio Murdaca wrote:
I'm not fond of blockIODevice embedded struct and specifying
major:minor for this. I think it will suffice specifying just a
Path and do the syscall.Stat to retrieve major:minor where it
needs to (I'm thinking about libcontainer as it's currently doing
for Rlimits for instance).

I'm fine with blockIODevice. One benefit is that we don't need to
specify ordering between mounting, mknod calls, and these resource
limits, because we can set major:minor limits before the path exists.

fine, I guess /proc/partitions or something could be used to map device numbers back to path but shouldn't be a problem now

@wking
Copy link
Contributor

wking commented Sep 16, 2015

89bed76 looks good to me, although I'm a bit surprised that all we
have to update are the Go types and examples. Can we add a longer
example linking to 1 and sketching out the intended mapping between
our docs and that interface? A list of options for each type with
their intended type, the fact that they're required, and a one-line
summary of their interpretation would help me anyway. For example:

  • major (int64, required) number for the devices that will be limited.
  • minor (int64, required) number for the devices that will be limited.
  • weight (int16, required) in CFQ IO scheduling

where I've tried to use the “whole thing reads like a sentence”
phrasing 2.

@runcom
Copy link
Member Author

runcom commented Sep 16, 2015

89bed76 looks good to me, although I'm a bit surprised that all we
have to update are the Go types and examples. Can we add a longer
example linking to 1 and sketching out the intended mapping between
our docs and that interface? A list of options for each type with
their intended type, the fact that they're required, and a one-line
summary of their interpretation would help me anyway. For example:

  • major (int64, required) number for the devices that will be limited.
  • minor (int64, required) number for the devices that will be limited.
  • weight (int16, required) in CFQ IO scheduling

where I've tried to use the “whole thing reads like a sentence”
phrasing 2.

Sounds good to have these docs around, I'll update.
Also, I guess the other resources fields need a bit of doc bump as well, I'll look into this as well in another PR.

@wking
Copy link
Contributor

wking commented Sep 16, 2015

On Wed, Sep 16, 2015 at 12:51:13PM -0700, W. Trevor King wrote:


[1]: https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt

These also talk about leaf_weight. While we're formalizing these
entries, do we want to expose that too?

Maybe with:

  • weight (int16, optional) when competing within this cgroup in
    CFQ IO scheduling

  • leafWeight (int16, optional) when competing with cgroup children
    in CFQ IO scheduling

    You must specify at least one of weight or leafWeight in a given
    entry, and can specify both.

Or we can have separate entries (like you're currently doing for
weight and throttle) for handling weight and leaf_weight. Or we can
punt for now, and come back and look at leaf_weight when someone asks
for it with a particular use-case in mind.

@wking
Copy link
Contributor

wking commented Sep 16, 2015

On Wed, Sep 16, 2015 at 12:56:08PM -0700, Antonio Murdaca wrote:

sounds good to have these docs around, I'll update

I had some other cgroups docs stubbing in #99 if you want to borrow
from there (although there hasn't been discussion about explicitly
handling device-access cgroups, so probably leave that section out ;).

@runcom
Copy link
Member Author

runcom commented Sep 16, 2015

Or we can have separate entries (like you're currently doing for
weight and throttle) for handling weight and leaf_weight.

these are separate cause one is dealing with weight and the other with rate

Or we can
punt for now, and come back and look at leaf_weight when someone asks
for it with a particular use-case in mind.

It shoudln't be so much hard to put leaf_weight into account. And I like your proposed struct with both weight and leaf_weight.

I had some other cgroups docs stubbing in #99 if you want to borrow
from there (although there hasn't been discussion about explicitly
handling device-access cgroups, so probably leave that section out ;).

Thanks!

@runcom runcom force-pushed the blkio-fixes branch 3 times, most recently from 8badb9d to 3c64554 Compare September 17, 2015 09:27
@hqhq
Copy link
Contributor

hqhq commented Sep 17, 2015

I'm not fond of blockIODevice embedded struct and specifying major:minor for this. I think it will suffice specifying just a Path and do the syscall.Stat to retrieve major:minor where it needs to (I'm thinking about libcontainer as it's currently doing for Rlimits for instance).

Though systemd takes device path instead of major minor number, but for struct, I think is't better to store just major minor numbers.

And +1 for this change.

@runcom runcom force-pushed the blkio-fixes branch 10 times, most recently from 0ee02e7 to 8366b2e Compare September 17, 2015 11:17
@runcom
Copy link
Member Author

runcom commented Sep 17, 2015

Though systemd takes device path instead of major minor number, but for struct, I think is't better to store just major minor numbers.

systemd was one of the reason I thought having Path would have been good. But whatever, I agree having device numbers is better.

@runcom runcom force-pushed the blkio-fixes branch 2 times, most recently from 6249ff5 to 7561a4a Compare September 17, 2015 12:42
@runcom runcom force-pushed the blkio-fixes branch 4 times, most recently from c896a0a to a89565b Compare September 17, 2015 12:50
@runcom
Copy link
Member Author

runcom commented Sep 17, 2015

ping @vbatts @mrunalp @LK4D4 @wking @hqhq

I've updated the structure of the cgroups section here by splitting the example into per resource section and filled the bllkio one as per current PR topic. If you're happy with this path/format I can do a follow up PR updating the rest of the resources (I'd leave this PR as is now w/o going any further with other modifications if you're ok with this)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our other examples use four-space indents for JSON, so it's probably better to stick with that and skip the tabs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, missed that

@wking
Copy link
Contributor

wking commented Sep 17, 2015

On Thu, Sep 17, 2015 at 05:55:38AM -0700, Antonio Murdaca wrote:

I've updated the structure of the cgroups section here by splitting
the example into per resource section and filled the bllkio one as
per current PR topic.

Looks good to me :). I've left a few copy-edit suggestions, but I'm
on board with all the significant changes in a89565b. I'd be fine if
it landed as-is, with follow up PRs to accept/reject my copy-edit
suggestions (but I'd rather they got rerolled in or rejected here ;).

@crosbymichael
Copy link
Member

LGTM

@runcom runcom force-pushed the blkio-fixes branch 8 times, most recently from 0c5d333 to 337a1b8 Compare September 17, 2015 18:29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: blkioThrottleReadIOPSDevicei

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

`WeightDevice`, `ThrottleReadBpsDevice`, `ThrottleWriteBpsDevice`,
`ThrottleReadIOpsDevice`, `ThrottleWriteIOpsDevice` are now slices to
well defined structs to allow setting multiple devices in their respective
blkio file. By using a string to represents those values it wasn't possible
to set correct values when multiple devices were passed in the config
(either newline separated or comma separated).

Signed-off-by: Antonio Murdaca <[email protected]>
@mrunalp
Copy link
Contributor

mrunalp commented Sep 17, 2015

LGTM

mrunalp pushed a commit that referenced this pull request Sep 17, 2015
runtime: config: linux: Edit BlockIO struct
@mrunalp mrunalp merged commit 3720db3 into opencontainers:master Sep 17, 2015
@runcom
Copy link
Member Author

runcom commented Sep 17, 2015

Thanks, I'll create a PR in runc to update libcontainer

@mrunalp
Copy link
Contributor

mrunalp commented Sep 17, 2015

@runcom Sounds good!

@runcom runcom deleted the blkio-fixes branch September 17, 2015 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants