coresched

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ExpellerGroupSuffix is the default suffix of the expeller core sched group.
	ExpellerGroupSuffix = "-expeller"
	// NoneGroupID is the special ID denoting none core sched group.
	NoneGroupID = "__0__"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieCacheEntry

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

CookieCacheEntry is an entry which stores the cookie ID and its belonging PIDs.

func (*CookieCacheEntry) AddPIDs

func (c *CookieCacheEntry) AddPIDs(pids ...uint32)

func (*CookieCacheEntry) ContainsPIDs

func (c *CookieCacheEntry) ContainsPIDs(pids ...uint32) []uint32

func (*CookieCacheEntry) DeepCopy

func (c *CookieCacheEntry) DeepCopy() *CookieCacheEntry

func (*CookieCacheEntry) DeletePIDs

func (c *CookieCacheEntry) DeletePIDs(pids ...uint32)

func (*CookieCacheEntry) GetAllPIDs

func (c *CookieCacheEntry) GetAllPIDs() []uint32

GetAllPIDs gets all PIDs sorted in ascending order.

func (*CookieCacheEntry) GetCookieID

func (c *CookieCacheEntry) GetCookieID() uint64

func (*CookieCacheEntry) HasPID

func (c *CookieCacheEntry) HasPID(pid uint32) bool

func (*CookieCacheEntry) IsEntryInvalid

func (c *CookieCacheEntry) IsEntryInvalid() bool

func (*CookieCacheEntry) SetCookieID

func (c *CookieCacheEntry) SetCookieID(cookieID uint64)

type PIDCache

type PIDCache map[uint32]struct{}

func NewPIDCache

func NewPIDCache(pids ...uint32) *PIDCache

func (PIDCache) AddAny

func (p PIDCache) AddAny(pids ...uint32)

func (PIDCache) DeepCopy

func (p PIDCache) DeepCopy() *PIDCache

func (PIDCache) DeleteAny

func (p PIDCache) DeleteAny(pids ...uint32)

func (PIDCache) GetAllSorted

func (p PIDCache) GetAllSorted() []uint32

func (PIDCache) Has

func (p PIDCache) Has(pid uint32) bool

func (PIDCache) Len

func (p PIDCache) Len() int

type Param

type Param struct {
	IsPodEnabled bool
	IsExpeller   bool
	IsCPUIdle    bool
}

type Plugin

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

Plugin is responsible for managing core sched cookies and cpu.idle for containers.

func Object

func Object() *Plugin

func (*Plugin) IsCacheInited

func (p *Plugin) IsCacheInited() bool

func (*Plugin) Register

func (p *Plugin) Register(op hooks.Options)

func (*Plugin) SetContainerCookie

func (p *Plugin) SetContainerCookie(proto protocol.HooksProtocol) error

SetContainerCookie reconciles the core sched cookie for the container. There are the following operations about the cookies:

  1. Get: Get the cookie for a core sched group, firstly try finding in cache and then get from the existing PIDs.
  2. Add: Add a new cookie for a core sched group for a container, and add a new entry into the cache.
  3. Assign: Assign a cookie of an existing core sched group for a container and update the cache entry. The cached sibling PIDs (i.e. the PIDs of the same core sched group) will be fetched in the Assign. If all cookies of the sibling PIDs are default or invalid, the Assign should fall back to Add.
  4. Clear: Clear a cookie of an existing core sched group for a container (reset to default cookie 0), and the containers' PIDs are removed from the cache. The cache entry of the group is removed when the number of the cached PIDs decreases to zero.

If multiple non-default cookies are assigned to existing containers of the same group, the firstly-created and available cookie will be retained and the PIDs of others will be moved to the former. NOTE: The agent itself should be set the default cookie. It can be excluded by setting QoS to SYSTEM.

func (*Plugin) SetKubeQOSCPUIdle

func (p *Plugin) SetKubeQOSCPUIdle(proto protocol.HooksProtocol) error

func (*Plugin) Setup

func (p *Plugin) Setup(op hooks.Options)

func (*Plugin) SystemSupported

func (p *Plugin) SystemSupported() bool

type Rule

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

func (*Rule) IsEnabled added in v1.4.1

func (r *Rule) IsEnabled() bool

func (*Rule) IsInited

func (r *Rule) IsInited() bool

func (*Rule) IsKubeQOSCPUIdle

func (r *Rule) IsKubeQOSCPUIdle(KubeQOS corev1.PodQOSClass) bool

func (*Rule) IsPodEnabled

func (r *Rule) IsPodEnabled(podQoSClass extension.QoSClass, podKubeQOS corev1.PodQOSClass) (bool, bool)

IsPodEnabled returns if the pod's core sched is enabled by the rule, and if the QoS-level core expeller is enabled.

func (*Rule) Update

func (r *Rule) Update(ruleNew *Rule) bool

Jump to

Keyboard shortcuts

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