Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v8
- uses: golangci/golangci-lint-action@v9
with:
version: v2.4.0
version: v2.11.4
args: --timeout=10m
Comment thread
fmuyassarov marked this conversation as resolved.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ ginkgo-tests:
--covermode atomic \
--output-dir $(COVERAGE_PATH) \
--junit-report junit.xml \
--coverprofile $(COVERAGE_PATH)/coverprofile \
--coverprofile coverprofile \
--keep-separate-coverprofiles \
--succinct \
--skip-package $$(echo $(GO_SUBPKGS) | tr -s '\t ' ',') \
Expand Down
108 changes: 54 additions & 54 deletions cmd/plugins/balloons/policy/balloons-policy.go

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions cmd/plugins/template/policy/template-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (p *policy) Setup(opts *policyapi.BackendOptions) error {

// Start prepares this policy for accepting allocation/release requests.
func (p *policy) Start() error {
log.Info("started...")
log.Infof("started...")
return nil
}

Expand All @@ -86,31 +86,31 @@ func (p *policy) Reconfigure(newCfg interface{}) error {

// Sync synchronizes the state of this policy.
func (p *policy) Sync(add []cache.Container, del []cache.Container) error {
log.Info("synchronizing state...")
log.Infof("synchronizing state...")
return nil
}

// AllocateResources is a resource allocation request for this policy.
func (p *policy) AllocateResources(container cache.Container) error {
log.Info("allocating resources for %s...", container.PrettyName())
log.Infof("allocating resources for %s...", container.PrettyName())
return nil
}

// ReleaseResources is a resource release request for this policy.
func (p *policy) ReleaseResources(container cache.Container) error {
log.Info("releasing resources of %s...", container.PrettyName())
log.Infof("releasing resources of %s...", container.PrettyName())
return nil
}

// UpdateResources is a resource allocation update request for this policy.
func (p *policy) UpdateResources(c cache.Container) error {
log.Info("(not) updating container %s...", c.PrettyName())
log.Infof("(not) updating container %s...", c.PrettyName())
return nil
}

// HandleEvent handles policy-specific events.
func (p *policy) HandleEvent(e *events.Policy) (bool, error) {
log.Info("received policy event %s.%s with data %v...", e.Source, e.Type, e.Data)
log.Infof("received policy event %s.%s with data %v...", e.Source, e.Type, e.Data)
return true, nil
}

Expand Down
12 changes: 6 additions & 6 deletions cmd/plugins/topology-aware/policy/affinity.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

// Calculate pool affinities for the given container.
func (p *policy) calculatePoolAffinities(container cache.Container) (map[int]int32, error) {
log.Debug("=> calculating pool affinities...")
log.Debugf("=> calculating pool affinities...")

affinities, err := p.calculateContainerAffinity(container)
if err != nil {
Expand All @@ -45,7 +45,7 @@ func (p *policy) calculatePoolAffinities(container cache.Container) (map[int]int

// Calculate affinity of this container (against all other containers).
func (p *policy) calculateContainerAffinity(container cache.Container) (map[string]int32, error) {
log.Debug("* calculating affinity for container %s...", container.PrettyName())
log.Debugf("* calculating affinity for container %s...", container.PrettyName())

ca, err := container.GetAffinity()
if err != nil {
Expand All @@ -62,7 +62,7 @@ func (p *policy) calculateContainerAffinity(container cache.Container) (map[stri
// self-affinity does not make sense, so remove any
delete(result, container.GetID())

log.Debug(" => affinity: %v", result)
log.Debugf(" => affinity: %v", result)

return result, nil
}
Expand All @@ -83,7 +83,7 @@ func (p *policy) registerImplicitAffinities() error {
}
pod, ok := c.GetPod()
if !ok {
log.Error("failed to inject pod-colocation affinity, can't find pod")
log.Errorf("failed to inject pod-colocation affinity, can't find pod")
return nil
}
return &cache.Affinity{
Expand Down Expand Up @@ -129,10 +129,10 @@ func (p *policy) registerImplicitAffinities() error {
del = append(del, name)

if !a.disabled {
log.Info("implicit affinity %s is enabled", a.name)
log.Infof("implicit affinity %s is enabled", a.name)
add[name] = a.affinity
} else {
log.Info("implicit affinity %s is disabled", a.name)
log.Infof("implicit affinity %s is disabled", a.name)
}
}

Expand Down
14 changes: 7 additions & 7 deletions cmd/plugins/topology-aware/policy/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (p *policy) restoreAllocations(allocations *allocations) error {
//

if err := p.reinstateGrants(allocations.grants); err != nil {
log.Error("failed to reinstate grants verbatim: %v", err)
log.Errorf("failed to reinstate grants verbatim: %v", err)
containers, poolHints := allocations.getContainerPoolHints()
if err := p.reallocateResources(containers, poolHints); err != nil {
p.allocations = savedAllocations
Expand Down Expand Up @@ -77,7 +77,7 @@ func (p *policy) reinstateGrants(grants map[string]Grant) error {

for id, grant := range grants {
if err := p.releaseMem(id); err != nil && !errors.Is(err, libmem.ErrUnknownRequest) {
log.Error("failed to release memory for grant %s: %v", grant, err)
log.Errorf("failed to release memory for grant %s: %v", grant, err)
}
}

Expand All @@ -101,18 +101,18 @@ func (p *policy) reinstateGrants(grants map[string]Grant) error {

for uID, uZone := range updates {
if ug, ok := p.allocations.grants[uID]; !ok {
log.Error("failed to update grant %s to memory zone to %s, grant not found",
log.Errorf("failed to update grant %s to memory zone to %s, grant not found",
uID, uZone)
} else {
ug.SetMemoryZone(uZone)
if opt.PinMemory {
ug.GetContainer().SetCpusetMems(uZone.MemsetString())
}
log.Info("updated grant %s to memory zone %s", uID, uZone)
log.Infof("updated grant %s to memory zone %s", uID, uZone)
}
}

log.Info("updated pool %q with reinstated CPU grant of %q, memory zone %s",
log.Infof("updated pool %q with reinstated CPU grant of %q, memory zone %s",
pool.Name(), c.PrettyName(), grant.GetMemoryZone())

p.allocations.grants[id] = grant
Expand Down Expand Up @@ -216,10 +216,10 @@ func (a *allocations) UnmarshalJSON(data []byte) error {
for id, ccg := range cgrants {
a.grants[id], err = ccg.ToGrant(a.policy)
if err != nil {
log.Error("removing unresolvable cached grant %v: %v", *ccg, err)
log.Errorf("removing unresolvable cached grant %v: %v", *ccg, err)
delete(a.grants, id)
} else {
log.Debug("resolved cache grant: %v", a.grants[id].String())
log.Debugf("resolved cache grant: %v", a.grants[id].String())
}
}

Expand Down
16 changes: 8 additions & 8 deletions cmd/plugins/topology-aware/policy/coldstart.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ import (

// trigger cold start for the container if necessary.
func (p *policy) triggerColdStart(c cache.Container) error {
log.Info("coldstart: triggering coldstart for %s...", c.PrettyName())
log.Infof("coldstart: triggering coldstart for %s...", c.PrettyName())
g, ok := p.allocations.grants[c.GetID()]
if !ok {
log.Warn("coldstart: no grant found, nothing to do...")
log.Warnf("coldstart: no grant found, nothing to do...")
return nil
}

coldStart := g.ColdStart()
if coldStart <= 0 {
log.Info("coldstart: no coldstart, nothing to do...")
log.Infof("coldstart: no coldstart, nothing to do...")
return nil
}

Expand All @@ -49,7 +49,7 @@ func (p *policy) triggerColdStart(c cache.Container) error {
}
if err := p.options.SendEvent(e); err != nil {
// we should retry this later, the channel is probably full...
log.Error("Ouch... we'should retry this later.")
log.Errorf("Ouch... we'should retry this later.")
}
})
g.AddTimer(timer)
Expand All @@ -60,16 +60,16 @@ func (p *policy) triggerColdStart(c cache.Container) error {
func (p *policy) finishColdStart(c cache.Container) (bool, error) {
g, ok := p.allocations.grants[c.GetID()]
if !ok {
log.Warn("coldstart: no grant found, nothing to do...")
log.Warnf("coldstart: no grant found, nothing to do...")
return false, policyError("coldstart: no grant found for %s", c.PrettyName())
}

log.Info("reallocating %s after coldstart", g)
log.Infof("reallocating %s after coldstart", g)
err := g.ReallocMemory(p.memZoneType(g.GetMemoryZone()) | libmem.TypeMaskDRAM)
if err != nil {
log.Error("failed to reallocate %s after coldstart: %v", g, err)
log.Errorf("failed to reallocate %s after coldstart: %v", g, err)
} else {
log.Info("reallocated %s", g)
log.Infof("reallocated %s", g)
}
g.ClearTimer()

Expand Down
8 changes: 4 additions & 4 deletions cmd/plugins/topology-aware/policy/hint.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func cpuHintScore(hint topology.Hint, CPUs cpuset.CPUSet) float64 {
hCPUs, err := cpuset.Parse(hint.CPUs)
if err != nil {
log.Warn("invalid hint CPUs '%s' from %s", hint.CPUs, hint.Provider)
log.Warnf("invalid hint CPUs '%s' from %s", hint.CPUs, hint.Provider)
return 0.0
}
common := hCPUs.Intersection(CPUs)
Expand All @@ -40,7 +40,7 @@ func numaHintScore(hint topology.Hint, sysIDs ...idset.ID) float64 {
for _, idstr := range strings.Split(hint.NUMAs, ",") {
hID, err := strconv.ParseInt(idstr, 0, 0)
if err != nil {
log.Warn("invalid hint NUMA node %s from %s", idstr, hint.Provider)
log.Warnf("invalid hint NUMA node %s from %s", idstr, hint.Provider)
return 0.0
}

Expand All @@ -61,7 +61,7 @@ func dieHintScore(hint topology.Hint, sysID idset.ID, socket system.CPUPackage)
for _, idstr := range strings.Split(hint.NUMAs, ",") {
hID, err := strconv.ParseInt(idstr, 0, 0)
if err != nil {
log.Warn("invalid hint NUMA node %s from %s", idstr, hint.Provider)
log.Warnf("invalid hint NUMA node %s from %s", idstr, hint.Provider)
return 0.0
}

Expand All @@ -78,7 +78,7 @@ func socketHintScore(hint topology.Hint, sysID idset.ID) float64 {
for _, idstr := range strings.Split(hint.Sockets, ",") {
id, err := strconv.ParseInt(idstr, 0, 0)
if err != nil {
log.Warn("invalid hint socket '%s' from %s", idstr, hint.Provider)
log.Warnf("invalid hint socket '%s' from %s", idstr, hint.Provider)
return 0.0
}
if id == int64(sysID) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/plugins/topology-aware/policy/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (m *TopologyAwareMetrics) Update() {

p := m.p
for _, pool := range p.pools {
log.Debug("updating metrics for pool %s...", pool.Name())
log.Debugf("updating metrics for pool %s...", pool.Name())

var (
zone = m.Zones[pool.Name()]
Expand All @@ -220,7 +220,7 @@ func (m *TopologyAwareMetrics) Update() {
)

if zone == nil {
log.Error("metrics zone not found for pool %s", pool.Name())
log.Errorf("metrics zone not found for pool %s", pool.Name())
continue
}

Expand Down
26 changes: 13 additions & 13 deletions cmd/plugins/topology-aware/policy/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,27 +333,27 @@ func (n *node) Dump(prefix string, level ...int) {
idt := indent(prefix, lvl)

n.self.node.dump(prefix, lvl)
log.Debug("%s - %s", idt, n.noderes.DumpCapacity())
log.Debug("%s - %s", idt, n.freeres.DumpAllocatable())
log.Debugf("%s - %s", idt, n.noderes.DumpCapacity())
log.Debugf("%s - %s", idt, n.freeres.DumpAllocatable())
if n.mem.Size() > 0 {
log.Debug("%s - normal memory: %v", idt, n.mem)
log.Debugf("%s - normal memory: %v", idt, n.mem)
}
if n.hbm.Size() > 0 {
log.Debug("%s - HBM memory: %v", idt, n.hbm)
log.Debugf("%s - HBM memory: %v", idt, n.hbm)
}
if n.pMem.Size() > 0 {
log.Debug("%s - PMEM memory: %v", idt, n.pMem)
log.Debugf("%s - PMEM memory: %v", idt, n.pMem)
}
for _, grant := range n.policy.allocations.grants {
if grant.GetCPUNode().NodeID() == n.id {
log.Debug("%s + %s", idt, grant)
log.Debugf("%s + %s", idt, grant)
}
}
if !n.Parent().IsNil() {
log.Debug("%s - parent: <%s>", idt, n.Parent().Name())
log.Debugf("%s - parent: <%s>", idt, n.Parent().Name())
}
if len(n.children) > 0 {
log.Debug("%s - children:", idt)
log.Debugf("%s - children:", idt)
for _, c := range n.children {
c.Dump(prefix, lvl+1)
}
Expand Down Expand Up @@ -482,7 +482,7 @@ func (p *policy) NewNumaNode(id idset.ID, parent Node) *numanode {

// Dump (the NUMA-specific parts of) this node.
func (n *numanode) dump(prefix string, level ...int) {
log.Debug("%s<NUMA node #%v>", indent(prefix, level...), n.id)
log.Debugf("%s<NUMA node #%v>", indent(prefix, level...), n.id)
}

// Get CPU supply available at this node.
Expand Down Expand Up @@ -546,7 +546,7 @@ func (p *policy) NewL3CacheNode(id idset.ID, cpus cpuset.CPUSet, parent Node) *l

// Dump (the L3 cache-specific parts of) this node.
func (n *l3cachenode) dump(prefix string, level ...int) {
log.Debug("%s<%s, cpus: %s>", indent(prefix, level...), n.name, n.cpus)
log.Debugf("%s<%s, cpus: %s>", indent(prefix, level...), n.name, n.cpus)
}

// GetSupply returns CPU supply available at this node.
Expand Down Expand Up @@ -625,7 +625,7 @@ func (p *policy) NewDieNode(id idset.ID, parent Node) *dienode {

// Dump (the die-specific parts of) this node.
func (n *dienode) dump(prefix string, level ...int) {
log.Debug("%s<die #%v/%v>", indent(prefix, level...), n.syspkg.ID(), n.id)
log.Debugf("%s<die #%v/%v>", indent(prefix, level...), n.syspkg.ID(), n.id)
}

// Get CPU supply available at this node.
Expand Down Expand Up @@ -694,7 +694,7 @@ func (p *policy) NewSocketNode(id idset.ID, parent Node) *socketnode {

// Dump (the socket-specific parts of) this node.
func (n *socketnode) dump(prefix string, level ...int) {
log.Debug("%s<socket #%v>", indent(prefix, level...), n.id)
log.Debugf("%s<socket #%v>", indent(prefix, level...), n.id)
}

// Get CPU supply available at this node.
Expand Down Expand Up @@ -756,7 +756,7 @@ func (p *policy) NewVirtualNode(name string, parent Node) *virtualnode {

// Dump (the virtual-node specific parts of) this node.
func (n *virtualnode) dump(prefix string, level ...int) {
log.Debug("%s<virtual %s>", indent(prefix, level...), n.name)
log.Debugf("%s<virtual %s>", indent(prefix, level...), n.name)
}

// Get CPU supply available at this node.
Expand Down
Loading
Loading