diff --git a/pkg/scheduler/framework/plugins/noderesources/resource_allocation.go b/pkg/scheduler/framework/plugins/noderesources/resource_allocation.go index 6715ccffab2..8e0e072216b 100644 --- a/pkg/scheduler/framework/plugins/noderesources/resource_allocation.go +++ b/pkg/scheduler/framework/plugins/noderesources/resource_allocation.go @@ -67,10 +67,12 @@ func (r *resourceAllocationScorer) score( score := r.scorer(requested, allocatable) - klog.V(10).InfoS("Listing internal info for allocatable resources, requested resources and score", "pod", - klog.KObj(pod), "node", klog.KObj(node), "resourceAllocationScorer", r.Name, - "allocatableResource", allocatable, "requestedResource", requested, "resourceScore", score, - ) + if klogV := klog.V(10); klogV.Enabled() { // Serializing these maps is costly. + klogV.InfoS("Listing internal info for allocatable resources, requested resources and score", "pod", + klog.KObj(pod), "node", klog.KObj(node), "resourceAllocationScorer", r.Name, + "allocatableResource", allocatable, "requestedResource", requested, "resourceScore", score, + ) + } return score, nil } diff --git a/pkg/scheduler/schedule_one.go b/pkg/scheduler/schedule_one.go index 4a45f5b4adb..c865c93815a 100644 --- a/pkg/scheduler/schedule_one.go +++ b/pkg/scheduler/schedule_one.go @@ -145,8 +145,9 @@ func (sched *Scheduler) schedulingCycle( if status.Code() == framework.Error { klog.ErrorS(nil, "Status after running PostFilter plugins for pod", "pod", klog.KObj(pod), "status", status) } else { - fitError.Diagnosis.PostFilterMsg = status.Message() - klog.V(5).InfoS("Status after running PostFilter plugins for pod", "pod", klog.KObj(pod), "status", status) + msg := status.Message() + fitError.Diagnosis.PostFilterMsg = msg + klog.V(5).InfoS("Status after running PostFilter plugins for pod", "pod", klog.KObj(pod), "status", msg) } if result != nil { nominatingInfo = result.NominatingInfo @@ -406,8 +407,9 @@ func (sched *Scheduler) findNodesThatFitPod(ctx context.Context, fwk framework.F return nil, diagnosis, s.AsError() } // Record the messages from PreFilter in Diagnosis.PreFilterMsg. - diagnosis.PreFilterMsg = s.Message() - klog.V(5).InfoS("Status after running PreFilter plugins for pod", "pod", klog.KObj(pod), "status", s) + msg := s.Message() + diagnosis.PreFilterMsg = msg + klog.V(5).InfoS("Status after running PreFilter plugins for pod", "pod", klog.KObj(pod), "status", msg) // Status satisfying IsUnschedulable() gets injected into diagnosis.UnschedulablePlugins. if s.FailedPlugin() != "" { diagnosis.UnschedulablePlugins.Insert(s.FailedPlugin())