Files
runc/libcontainer/configs/memorypolicy.go
T
Aleksa Sarai a0e809a8ba libct: switch to unix.SetMemPolicy wrapper
This is mostly a mechanical change, but we also need to change some
types to match the "mode int" argument that golang.org/x/sys/unix
decided to use.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2025-11-10 16:03:02 +11:00

32 lines
976 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 int `json:"mode,omitempty"`
// Flags contains mode flags.
Flags int `json:"flags,omitempty"`
// Nodes contains NUMA nodes to which the mode applies.
Nodes *unix.CPUSet `json:"nodes,omitempty"`
}