github.com/kubewharf/katalyst-core@v0.5.3/pkg/config/agent/qrm/cpu_plugin.go (about)

     1  /*
     2  Copyright 2022 The Katalyst Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package qrm
    18  
    19  type CPUQRMPluginConfig struct {
    20  	// PolicyName is used to switch between several strategies
    21  	PolicyName string
    22  	// ReservedCPUCores indicates reserved cpus number for system agents
    23  	ReservedCPUCores int
    24  	// SkipCPUStateCorruption is set to skip cpu state corruption, and it will be used after updating state properties
    25  	SkipCPUStateCorruption bool
    26  
    27  	CPUDynamicPolicyConfig
    28  	CPUNativePolicyConfig
    29  }
    30  
    31  type CPUDynamicPolicyConfig struct {
    32  	// EnableCPUAdvisor indicates whether to enable sys-advisor module to calculate cpu resources
    33  	EnableCPUAdvisor bool
    34  	// EnableCPUPressureEviction indicates whether to enable cpu-pressure eviction, such as cpu load eviction or cpu
    35  	// suppress eviction
    36  	EnableCPUPressureEviction bool
    37  	// LoadPressureEvictionSkipPools indicates the ignored pools when check load pressure.
    38  	LoadPressureEvictionSkipPools []string
    39  	// EnableSyncingCPUIdle is set to sync specific cgroup path with EnableCPUIdle
    40  	EnableSyncingCPUIdle bool
    41  	// EnableCPUIdle indicates whether enabling cpu idle
    42  	EnableCPUIdle bool
    43  }
    44  
    45  type CPUNativePolicyConfig struct {
    46  	// EnableFullPhysicalCPUsOnly is a flag to enable extra allocation restrictions to avoid
    47  	// different containers to possibly end up on the same core.
    48  	EnableFullPhysicalCPUsOnly bool
    49  	// CPUAllocationOption is the allocation option of cpu (packed/distributed).
    50  	CPUAllocationOption string
    51  }
    52  
    53  func NewCPUQRMPluginConfig() *CPUQRMPluginConfig {
    54  	return &CPUQRMPluginConfig{
    55  		CPUDynamicPolicyConfig: CPUDynamicPolicyConfig{},
    56  		CPUNativePolicyConfig:  CPUNativePolicyConfig{},
    57  	}
    58  }