From 32ee7d3309816994a02b3ff000e9734120d71214 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Thu, 15 Jan 2015 20:08:42 +0100 Subject: cgroup: add support for net_cls controllers Add a new config directive called NetClass= to CGroup enabled units. Allowed values are positive numbers for fix assignments and "auto" for picking a free value automatically, for which we need to keep track of dynamically assigned net class IDs of units. Introduce a hash table for this, and also record the last ID that was given out, so the allocator can start its search for the next 'hole' from there. This could eventually be optimized with something like an irb. The class IDs up to 65536 are considered reserved and won't be assigned automatically by systemd. This barrier can be made a config directive in the future. Values set in unit files are stored in the CGroupContext of the unit and considered read-only. The actually assigned number (which may have been chosen dynamically) is stored in the unit itself and is guaranteed to remain stable as long as the unit is active. In the CGroup controller, set the configured CGroup net class to net_cls.classid. Multiple unit may share the same net class ID, and those which do are linked together. --- man/systemd.unit.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'man') diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index ea58580bba..015deab4bb 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -1044,6 +1044,20 @@ files. This functionality should not be used in normal units. + + + NetClass= + Configures a network class number to assign to the + unit. This value will be set to the + net_cls.class_id property of the + net_cls cgroup of the unit. The directive + accepts a numerical value (for fixed number assignment) and the keyword + auto (for dynamic allocation). Network traffic of + all processes inside the unit will have the network class ID assigned + by the kernel. Also see + systemd.resource-control5 + . + -- cgit v1.2.3-54-g00ecf