runc/libcontainer/configs
Xiaochen Shen 27560ace2f libcontainer: intelrdt: add support for Intel RDT/MBA in runc
Memory Bandwidth Allocation (MBA) is a resource allocation sub-feature
of Intel Resource Director Technology (RDT) which is supported on some
Intel Xeon platforms. Intel RDT/MBA provides indirect and approximate
throttle over memory bandwidth for the software. A user controls the
resource by indicating the percentage of maximum memory bandwidth.

Hardware details of Intel RDT/MBA can be found in section 17.18 of
Intel Software Developer Manual:
https://software.intel.com/en-us/articles/intel-sdm

In Linux 4.12 kernel and newer, Intel RDT/MBA is enabled by kernel
config CONFIG_INTEL_RDT. If hardware support, CPU flags `rdt_a` and
`mba` will be set in /proc/cpuinfo.

Intel RDT "resource control" filesystem hierarchy:
mount -t resctrl resctrl /sys/fs/resctrl
tree /sys/fs/resctrl
/sys/fs/resctrl/
|-- info
|   |-- L3
|   |   |-- cbm_mask
|   |   |-- min_cbm_bits
|   |   |-- num_closids
|   |-- MB
|       |-- bandwidth_gran
|       |-- delay_linear
|       |-- min_bandwidth
|       |-- num_closids
|-- ...
|-- schemata
|-- tasks
|-- <container_id>
    |-- ...
    |-- schemata
    |-- tasks

For MBA support for `runc`, we will reuse the infrastructure and code
base of Intel RDT/CAT which implemented in #1279. We could also make
use of `tasks` and `schemata` configuration for memory bandwidth
resource constraints.

The file `tasks` has a list of tasks that belongs to this group (e.g.,
<container_id>" group). Tasks can be added to a group by writing the
task ID to the "tasks" file (which will automatically remove them from
the previous group to which they belonged). New tasks created by
fork(2) and clone(2) are added to the same group as their parent.

The file `schemata` has a list of all the resources available to this
group. Each resource (L3 cache, memory bandwidth) has its own line and
format.

Memory bandwidth schema:
It has allocation values for memory bandwidth on each socket, which
contains L3 cache id and memory bandwidth percentage.
    Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."

The minimum bandwidth percentage value for each CPU model is predefined
and can be looked up through "info/MB/min_bandwidth". The bandwidth
granularity that is allocated is also dependent on the CPU model and
can be looked up at "info/MB/bandwidth_gran". The available bandwidth
control steps are: min_bw + N * bw_gran. Intermediate values are
rounded to the next control step available on the hardware.

For more information about Intel RDT kernel interface:
https://www.kernel.org/doc/Documentation/x86/intel_rdt_ui.txt

An example for runc:
Consider a two-socket machine with two L3 caches where the minimum
memory bandwidth of 10% with a memory bandwidth granularity of 10%.
Tasks inside the container may use a maximum memory bandwidth of 20%
on socket 0 and 70% on socket 1.

"linux": {
    "intelRdt": {
        "memBwSchema": "MB:0=20;1=70"
    }
}

Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
2018-10-16 14:29:29 +08:00
..
validate libcontainer: intelrdt: add support for Intel RDT/MBA in runc 2018-10-16 14:29:29 +08:00
blkio_device.go Adjust runc to new opencontainers/specs version 2015-10-03 12:25:33 +02:00
cgroup_linux.go Update memory specs to use int64 not uint64 2017-06-27 12:16:07 +01:00
cgroup_windows.go Windows: Refactor configs/cgroup.go 2015-10-23 13:08:18 -07:00
config.go libcontainer: intelrdt: add support for Intel RDT/MBA in runc 2018-10-16 14:29:29 +08:00
config_linux.go Clean up unix vs linux usage 2017-05-12 17:22:09 +01:00
config_linux_test.go Clean up unix vs linux usage 2017-05-12 17:22:09 +01:00
config_test.go Update runtime spec to 1.0.0.rc5 2017-03-15 11:38:37 -07:00
config_windows_test.go Windows: Refactor state struct 2015-10-26 14:45:20 -07:00
device.go Update runc for devices changes 2016-02-08 13:15:12 -08:00
device_defaults.go libcontainer: drop FreeBSD support 2017-11-24 14:51:05 +01:00
hugepage_limit.go Adjust runc to new opencontainers/specs version 2015-10-03 12:25:33 +02:00
intelrdt.go libcontainer: intelrdt: add support for Intel RDT/MBA in runc 2018-10-16 14:29:29 +08:00
interface_priority_map.go Move libcontainer into subdirectory 2015-06-21 19:29:15 -07:00
mount.go config: Add new Extensions flag to support custom mount options in runc 2016-09-30 09:46:46 -07:00
namespaces.go Move libcontainer into subdirectory 2015-06-21 19:29:15 -07:00
namespaces_linux.go Always save own namespace paths 2017-07-13 16:13:05 +08:00
namespaces_syscall.go Move libcontainer to x/sys/unix 2017-05-22 17:35:20 -05:00
namespaces_syscall_unsupported.go Fix go_vet errors 2017-01-06 10:20:27 +08:00
namespaces_unsupported.go Clean up unix vs linux usage 2017-05-12 17:22:09 +01:00
network.go Move libcontainer into subdirectory 2015-06-21 19:29:15 -07:00