[systemd-devel] regarding to cgroup siblings mask

David Timothy Strauss david at davidstrauss.net
Thu Mar 26 13:33:28 PDT 2015


On Tue, Mar 24, 2015 at 4:29 AM, WaLyong Cho <walyong.cho at samsung.com> wrote:
> Could anyone explain why?

An admin using CPUShares= or a similar proportional CGroup controller
probably assumes that setting the shares to twice the default (for
example) increases the relative proportion of resources for that unit.
However, that is only true if other units competing for that resource
have the same controller(s) enabled so that the kernel knows to
balance the resources accordingly.

The code in systemd ensures that if any unit uses a proportional
CGroups controller in a slice, all other units in that same slice
enable that controller as well, usually with the default proportions.

unit_get_target_mask() is part of an optimization I added so that
initializing CGroups controllers for a given unit doesn't require
iterating through every other unit in a slice to figure out the
necessary controllers. It provides a bitmask indicating the
controllers in use by its siblings so the unit can enable, say,
CPUShares= if one of its siblings is doing so.


More information about the systemd-devel mailing list