mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
eda7bdf80c
Implement support for Linux memory policy in OCI spec PR: https://github.com/opencontainers/runtime-spec/pull/1282 Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
32 lines
978 B
Go
32 lines
978 B
Go
package configs
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
// Memory policy modes and flags as defined in /usr/include/linux/mempolicy.h
|
|
|
|
//nolint:revive,staticcheck,nolintlint // ignore ALL_CAPS errors in consts from numaif.h, will match unix.* in the future
|
|
const (
|
|
MPOL_DEFAULT = 0
|
|
MPOL_PREFERRED = 1
|
|
MPOL_BIND = 2
|
|
MPOL_INTERLEAVE = 3
|
|
MPOL_LOCAL = 4
|
|
MPOL_PREFERRED_MANY = 5
|
|
MPOL_WEIGHTED_INTERLEAVE = 6
|
|
|
|
MPOL_F_STATIC_NODES = 1 << 15
|
|
MPOL_F_RELATIVE_NODES = 1 << 14
|
|
MPOL_F_NUMA_BALANCING = 1 << 13
|
|
)
|
|
|
|
// LinuxMemoryPolicy contains memory policy configuration.
|
|
type LinuxMemoryPolicy struct {
|
|
// Mode specifies memory policy mode without mode flags. See
|
|
// set_mempolicy() documentation for details.
|
|
Mode uint `json:"mode,omitempty"`
|
|
// Flags contains mode flags.
|
|
Flags uint `json:"flags,omitempty"`
|
|
// Nodes contains NUMA nodes to which the mode applies.
|
|
Nodes *unix.CPUSet `json:"nodes,omitempty"`
|
|
}
|