cgroup

package
v0.0.0-...-3e0e934 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0, BSD-2-Clause Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const CgPoolIdLimit = math.MaxUint16 + 1
View Source
const CgPoolV1IdLimit = CgPoolIdLimit

Variables

This section is empty.

Functions

func AddProc

func AddProc(path string, pid uint64) error

func CgroupID2NumaID

func CgroupID2NumaID(fullCgID uint32) (int, error)

func IsPoolV2ID

func IsPoolV2ID(fullCgID uint32) bool

func MakeCgroupPathByID

func MakeCgroupPathByID(id uint32) string

func MakeCgroupPoolV1PathByString

func MakeCgroupPoolV1PathByString(group string) string

func MakeCgroupPoolV2PathByString

func MakeCgroupPoolV2PathByString(group string) string

func MakeFullCgID

func MakeFullCgID(id uint16, usePoolV2 bool, numa int32) uint32

func MakeNoPrefixCgroupPathByID

func MakeNoPrefixCgroupPathByID(id uint32) string

func SetCubeboxCgroupLimit

func SetCubeboxCgroupLimit(ctx context.Context, group string, cpuQ resource.Quantity, memQ resource.Quantity, usePoolV2 bool) error

Types

type CgPlugin

type CgPlugin struct {
	// contains filtered or unexported fields
}

func (*CgPlugin) CleanUp

func (l *CgPlugin) CleanUp(ctx context.Context, opts *workflow.CleanContext) error

func (*CgPlugin) CollectMetric

func (l *CgPlugin) CollectMetric(ctx context.Context) *CgroupMetrics

func (*CgPlugin) Create

func (l *CgPlugin) Create(ctx context.Context, opts *workflow.CreateContext) (err error)

func (*CgPlugin) Destroy

func (l *CgPlugin) Destroy(ctx context.Context, opts *workflow.DestroyContext) error

func (*CgPlugin) ID

func (l *CgPlugin) ID() string

func (*CgPlugin) Init

func (l *CgPlugin) Init(ctx context.Context, opts *workflow.InitInfo) error

func (*CgPlugin) RegisterOperation

func (l *CgPlugin) RegisterOperation(mux *http.ServeMux) error

func (*CgPlugin) ReloadVmSnapshotSpecs

func (l *CgPlugin) ReloadVmSnapshotSpecs() error

type CgroupMetrics

type CgroupMetrics struct {
	QuotaCpuUsage   int   `json:"quota_cpu_usage,omitempty"`
	QuotaMemMbUsage int64 `json:"quota_mem_mb_usage,omitempty"`
	MvmNum          int   `json:"mvm_num,omitempty"`
}

type Config

type Config struct {
	RootPath                    string `toml:"root_path"`
	PoolSize                    int    `toml:"pool_size"`
	PoolTriggerIntervalInMs     int    `toml:"pool_trigger_interval_in_ms"`
	VmMemoryOverheadBase        string `toml:"vm_memory_overhead_base"`
	VmMemoryOverheadCoefficient int64  `toml:"vm_memory_overhead_coefficient"`
	HostMemoryOverheadBase      string `toml:"host_memory_overhead_base"`
	CubeMsgMemoryOverhead       string `toml:"cubemsg_memory_overhead"`
	VmCpuOverhead               string `toml:"vm_cpu_overhead"`
	HostCpuOverhead             string `toml:"host_cpu_overhead"`
	DisableCgroupReuse          bool   `toml:"disable_cgroup_reuse"`
	VmSnapshotSpecsConfig       string `toml:"vm_snapshot_specs_config"`

	SnapshotDiskDir string `toml:"snapshot_disk_dir"`
	// contains filtered or unexported fields
}

func (*Config) ShouldSetMemoryReparentFile

func (c *Config) ShouldSetMemoryReparentFile() bool

type CubeVMMResource

type CubeVMMResource struct {
	CPU int64 `json:"cpu"`

	Memory int64 `json:"memory"`

	SnapMemory int64 `json:"snap_memory"`

	PreservedMemory     int64 `json:"preserve_memory"`
	SnapPreservedMemory int64 `json:"-"`
}

type Info

type Info struct {
	CgroupID         string
	ResourceQuantity cubeboxstore.ResourceWithOverHead
	VmSnapshotSpec   CubeVMMResource
	UsePoolV2        bool
}

type OverheadConfig

type OverheadConfig struct {
	VmMemoryBase        resource.Quantity
	VmMemoryCoefficient decimal.Decimal
	HostMemoryBase      resource.Quantity
	CubeMsgMemory       resource.Quantity

	VmCpu   resource.Quantity
	HostCpu resource.Quantity

	SnapshotDiskDir string
}

func (*OverheadConfig) GetResourceWithOverhead

func (overhead *OverheadConfig) GetResourceWithOverhead(ctx context.Context, realReq *cubebox.RunCubeSandboxRequest, volumeInfo interface{}) (rq *cubeboxstore.ResourceWithOverHead, err error)

func (*OverheadConfig) MatchVMSnapshotSpec

func (overhead *OverheadConfig) MatchVMSnapshotSpec(ctx context.Context, req cubeboxstore.ResourceWithOverHead,
	snaps []VmSnapshotSpec, instanceType string) (CubeVMMResource, *cubeboxstore.ResourceWithOverHead)

type VMSnapshotSpecsByProduct

type VMSnapshotSpecsByProduct map[string][]VmSnapshotSpec

type VmSnapshotSpec

type VmSnapshotSpec struct {
	CPU                 int    `json:"cpu"`
	Memory              int    `json:"memory"`
	Product             string `json:"product"`
	SnapPreservedMemory int    `json:"preserve_memory"`
}

Directories

Path Synopsis
v1
v2

Jump to

Keyboard shortcuts

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