Documentation ¶
Index ¶
Constants ¶
View Source
const ( // PolicyName is the symbol used to pull us in as a builtin policy. PolicyName = "topology-aware" // PolicyDescription is a short description of this policy. PolicyDescription = "A policy for HW-topology aware workload placement." // PolicyPath is the path of this policy in the configuration hierarchy. PolicyPath = "policy." + PolicyName )
View Source
const (
IndentDepth = 4
)
indent produces an indentation string for the given level.
View Source
const (
// OverfitPenalty is the per layer penalty for overfitting in the node tree.
OverfitPenalty = 0.9
)
Variables ¶
This section is empty.
Functions ¶
func CreateTopologyAwarePolicy ¶
func CreateTopologyAwarePolicy(opts *policyapi.BackendOptions) policyapi.Backend
CreateTopologyAwarePolicy creates a new policy instance.
Types ¶
type CPUGrant ¶
type CPUGrant interface { // GetContainer returns the container CPU capacity is granted to. GetContainer() cache.Container // GetNode returns the node that granted CPU capacity to the container. GetNode() Node // ExclusiveCPUs returns the exclusively granted non-isolated cpuset. ExclusiveCPUs() cpuset.CPUSet SharedCPUs() cpuset.CPUSet SharedPortion() int // IsolatedCpus returns the exclusively granted isolated cpuset. IsolatedCPUs() cpuset.CPUSet // String returns a printable representation of this grant. String() string }
CPUGrant represents CPU capacity allocated to a container from a node.
type CPURequest ¶
type CPURequest interface { // GetContainer returns the container requesting CPU capacity. GetContainer() cache.Container // String returns a printable representation of this request. String() string // FullCPUs return the number of full CPUs requested. FullCPUs() int // CPUFraction returns the amount of fractional milli-CPU requested. CPUFraction() int // Isolate returns whether isolated CPUs are preferred for this request. Isolate() bool // Elevate returns the requested elevation/allocation displacement for this request. Elevate() int }
CPURequest represents a CPU resources requested by a container.
type CPUScore ¶
type CPUScore interface { // Calculate the actual score from the collected parameters. Eval() float64 // CPUSupply returns the supply associated with this score. CPUSupply() CPUSupply // CPURequest returns the request associated with this score. CPURequest() CPURequest IsolatedCapacity() int Colocated() int HintScores() map[string]float64 String() string }
CPUScore represents how well a supply can satisfy a request.
type CPUSupply ¶
type CPUSupply interface { // GetNode returns the node supplying this capacity. GetNode() Node // Clone creates a copy of this CPUSupply. Clone() CPUSupply // IsolatedCPUs returns the isolated cpuset in this supply. IsolatedCPUs() cpuset.CPUSet // SharableCPUs returns the sharable cpuset in this supply. SharableCPUs() cpuset.CPUSet // Granted returns the locally granted capacity in this supply. Granted() int // Cumulate cumulates the given supply into this one. Cumulate(CPUSupply) // AccountAllocate accounts for (removes) allocated exclusive capacity from the supply. AccountAllocate(CPUGrant) // AccountRelease accounts for (reinserts) released exclusive capacity into the supply. AccountRelease(CPUGrant) // GetScore calculates how well this supply fits/fulfills the given request. GetScore(CPURequest) CPUScore // Allocate allocates CPU capacity from this supply and returns it as a grant. Allocate(CPURequest) (CPUGrant, error) // Release releases a previously allocated grant. Release(CPUGrant) // String returns a printable representation of this supply. String() string }
CPUSupply represents avaialbe CPU capacity of a node.
type Node ¶
type Node interface { // IsNil tests if this node is nil. IsNil() bool // Name returns the name of this node. Name() string // Kind returns the type of this node. Kind() NodeKind // NodeID returns the (enumerated) node id of this node. NodeID() int // Parent returns the parent node of this node. Parent() Node // Children returns the child nodes of this node. Children() []Node // LinkParent sets the given node as the parent node, and appends this node as a its child. LinkParent(Node) // AddChildren appends the nodes to the children, *WITHOUT* updating their parents. AddChildren([]Node) // IsSameNode returns true if the given node is the same as this one. IsSameNode(Node) bool // IsRootNode returns true if this node has no parent. IsRootNode() bool // IsLeafNode returns true if this node has no children. IsLeafNode() bool // Get the distance of this node from the root node. RootDistance() int // Get the height of this node (inverse of depth: tree depth - node depth). NodeHeight() int // System returns the policy sysfs instance. System() discoveredSystem // Policy returns the policy back pointer. Policy() *policy // DiscoverCPU DiscoverCPU() CPUSupply // GetCPU returns the full CPU at this node. GetCPU() CPUSupply // FreeCPU returns the available CPU supply of this node. FreeCPU() CPUSupply // GrantedCPU returns the amount of granted shared CPU capacity of this node. GrantedCPU() int // GetMemset GetMemset() system.IDSet // DiscoverMemset DiscoverMemset() system.IDSet // DepthFirst traverse the tree@node calling the function at each node. DepthFirst(func(Node) error) error // BreadthFirst traverse the tree@node calling the function at each node. BreadthFirst(func(Node) error) error // Dump state of the node. Dump(string, ...int) GetScore(CPURequest) CPUScore HintScore(system.TopologyHint) float64 // contains filtered or unexported methods }
Node is the abstract interface our partition tree nodes implement.
type NodeKind ¶
type NodeKind string
NodeKind represents a unique node type.
const ( // NilNode is the type of a nil node. NilNode NodeKind = "" // UnknownNode is the type of unknown node type. UnknownNode NodeKind = "unknown" // SocketNode represents a physical CPU package/socket in the system. SocketNode NodeKind = "socket" // NumaNode represents a NUMA node in the system. NumaNode NodeKind = "numa node" // VirtualNode represents a virtual node, currently the root multi-socket setups. VirtualNode NodeKind = "virtual node" )
Click to show internal directories.
Click to hide internal directories.