cgutil

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2021 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCgroupParent      = "/nomad"
	SharedCpusetCgroupName   = "shared"
	ReservedCpusetCgroupName = "reserved"
)

Variables

This section is empty.

Functions

func FindCgroupMountpointDir

func FindCgroupMountpointDir() (string, error)

FindCgroupMountpointDir is used to find the cgroup mount point on a Linux system.

func GetCPUsFromCgroup

func GetCPUsFromCgroup(group string) ([]uint16, error)

Types

type CgroupPathGetter

type CgroupPathGetter func(context.Context) (path string, err error)

CgroupPathGetter is a function which returns the cgroup path and any error which ocured during cgroup initialization. It should block until the cgroup has been created or an error is reported

type CpusetManager

type CpusetManager interface {
	// Init should be called before any tasks are managed to ensure the cgroup parent exists and
	// check that proper permissions are granted to manage cgroups.
	Init() error

	// AddAlloc adds an allocation to the manager
	AddAlloc(alloc *structs.Allocation)

	// RemoveAlloc removes an alloc by ID from the manager
	RemoveAlloc(allocID string)

	// CgroupPathFor returns a callback for getting the cgroup path and any error that may have occurred during
	// cgroup initialization. The callback will block if the cgroup has not been created
	CgroupPathFor(allocID, taskName string) CgroupPathGetter
}

CpusetManager is used to setup cpuset cgroups for each task. A pool of shared cpus is managed for tasks which don't require any reserved cores and a cgroup is managed seperetly for each task which require reserved cores.

func NewCpusetManager

func NewCpusetManager(cgroupParent string, logger hclog.Logger) CpusetManager

func NoopCpusetManager

func NoopCpusetManager() CpusetManager

type TaskCgroupInfo

type TaskCgroupInfo struct {
	CgroupPath         string
	RelativeCgroupPath string
	Cpuset             cpuset.CPUSet
	Error              error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL